1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Setler [38]
3 years ago
8

Create the logic for a program that prompts a user for 12 numbers and stores them in an array. Pass the array to a method that r

everses the order of the numbers. Display the reversed numbers in the main program.
Computers and Technology
1 answer:
REY [17]3 years ago
7 0

Answer:

Explanation:

The following program is written in Python. It first creates a method that reverses the array using the built in reverse function. Then it creates the array, creates a loop to ask the user to enter 12 numbers while passing each input into the array. Finally, it passes that array into the previously created reverse method and prints out the new array.

def reverse(num_arr):

   num_arr.reverse()

   return num_arr

num_arr = []

for x in range(12):

   num = input("Enter a number")

   num_arr.append(num)

print(reverse(num_arr))

You might be interested in
Devices which are used to receive data from central processing unit are classified as
denis23 [38]

Answer:

Input devices are used to receive data from central Processing Unit.

Explanation:

7 0
2 years ago
In a graphical user interface, which is a small symbol on the screen whose location and shape changes as a user moves a pointing
ollegr [7]

Answer:

a pointer or cursor

Explanation:

6 0
3 years ago
When using presentation aids A. make the aid available for the audience to look at throughout the speech. B. prepare to give you
DanielleElmas [232]

Answer: options A and B.

Option A, make the aid available for the audience to look at throughout the speech.

Option B, prepare to give your presentation without the aids, incase problem arises.

Explanation:

Presentation aids, sometimes also called sensory aids, are the resources beyond the speech itself that a speaker uses to enhance the message conveyed to the audience.

The type of presentation aids that speakers mostly make use of are visual aids; pictures, diagrams, charts and graphs, maps... Audible aids (musical excerpt, sound effects) and olfactory aids (fragrance samples or food samples) are also used.

* Presentation aids can be used throughout the speech but it should be used for essential points so as to to tire or bore the audience.

* Ensure presentation still works without the presentation aids in case of technical problems or if any problem arises at all.

* While explaining the aids, focus should be on the audience and not the presentation aids itself.

* Practice should be done with the presentation aids in advance so as to avoid any error while presenting.

Therefore, options A, B should be done when using presentation aids.

6 0
3 years ago
g Write a program to sort an array of 100,000 random elements using quicksort as follows: Sort the arrays using pivot as the mid
shtirl [24]

Answer:

header.h->function bodies and header files.

#include<iostream>

#include<cstdlib>

#include<ctime>

using namespace std;

/* Partitioning the array on the basis of piv value. */

int Partition(int a[], int bot, int top,string opt)

{

int piv, ind=bot, i, swp;

/*Finding the piv value according to string opt*/

if(opt=="Type1 sort" || opt=="Type3 sort")

{

piv=(top+bot)/2;

}

else if(opt=="Type2 sort" || opt=="Type4 sort")

{

piv=(top+bot)/2;

if((a[top]>=a[piv] && a[top]<=a[bot]) || (a[top]>=a[bot] && a[top]<=a[piv]))

piv=top;

else if((a[bot]>=a[piv] && a[bot]<=a[top]) || (a[bot]>=a[top] && a[bot]<=a[piv]))

piv=bot;

}

swp=a[piv];

a[piv]=a[top];

a[top]=swp;

piv=top;

/*Getting ind of the piv.*/

for(i=bot; i < top; i++)

{

if(a[i] < a[piv])

{

swp=a[i];

a[i]=a[ind];

a[ind]=swp;

ind++;

}

}

swp=a[piv];

a[piv]=a[ind];

a[ind]=swp;

return ind;

}

void QuickSort(int a[], int bot, int top, string opt)

{

int pindex;

if((opt=="Type3 sort" || opt=="Type4 sort") && top-bot<19)

{

/*then insertion sort*/

int swp,ind;

for(int i=bot+1;i<=top;i++){

swp=a[i];

ind=i;

for(int j=i-1;j>=bot;j--){

if(swp<a[j]){

a[j+1]=a[j];

ind=j;

}

else

break;

}

a[ind]=swp;

}

}

else if(bot < top)

{

/* Partitioning the array*/

pindex =Partition(a, bot, top,opt);

/* Recursively implementing QuickSort.*/

QuickSort(a, bot, pindex-1,opt);

QuickSort(a, pindex+1, top,opt);

}

return ;

}

main.cpp->main driver file

#include "header.h"

int main()

{

int n=100000, i;

/*creating randomized array of 100000 numbers between 0 and 100001*/

int arr[n];

int b[n];

for(i = 0; i < n; i++)

arr[i]=(rand() % 100000) + 1;

clock_t t1,t2;

t1=clock();

QuickSort(arr, 0, n-1,"Type1 sort");

t2=clock();

for( i=0;i<n;i++)

arr[i]=b[i];

cout<<"Quick sort time, with pivot middle element:"<<(t2 - t1)*1000/ ( CLOCKS_PER_SEC );

cout<<"\n";

t1=clock();

QuickSort(arr, 0, n-1,"Type2 sort");

t2=clock();

for( i=0;i<n;i++)

arr[i]=b[i];

cout<<"Quick sort time, with pivot median element:"<<(t2 - t1)*1000/ ( CLOCKS_PER_SEC );

cout<<"\n";

t1=clock();

QuickSort(arr, 0, n-1,"Type3 sort");

t2=clock();

for( i=0;i<n;i++)

arr[i]=b[i];

cout<<"Quick sort time and insertion sort time, with pivot middle element:"<<(t2 - t1)*1000/ ( CLOCKS_PER_SEC );

cout<<"\n";

t1=clock();

QuickSort(arr, 0, n-1,"Type4 sort");

t2=clock();

cout<<"Quick sort time and insertion sort time, with pivot median element:"<<(t2 - t1)*1000/ ( CLOCKS_PER_SEC );

return 0;

}

Explanation:

Change the value of n in the main file for different array size. Output is in the same format as mentioned, time is shown in milliseconds.

7 0
3 years ago
​some forms use a _____ that contains icons or buttons that represent shortcuts for executing common commands.
Galina-37 [17]

GUI, AKA Graphical User Interface

3 0
2 years ago
Other questions:
  • A ________ is a system of hardware and software that stores user data in many different geographical locations and makes that da
    14·1 answer
  • What shooting position is commonly used when hunting with a shotgun?
    14·2 answers
  • What makes Group Policy such a powerful tool is its ability to enable security administrators to:_________.
    8·1 answer
  • Marie uses a browser to visit a blog. What is the unique identifier of the blog?
    13·2 answers
  • What is a computer network?
    5·1 answer
  • Our readings so far explored computer hardware and software, in particular operating systems and application software. There are
    11·1 answer
  • The idea that innovations in transportation and communication technologies has changed the way we think about distance and time
    9·1 answer
  • Write a program Gas.java that computes and displays the price a person will pay for gas at the gas station. The program takes th
    12·1 answer
  • I need help with workplace safety systems please help
    10·1 answer
  • put together a shopping list of items that a first responder should always have at immediate disposal in a field kit. Using curr
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!