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
Darya [45]
3 years ago
10

write a program that will create an array of 100 random integers in the range from [0,99] pass the array to a function, printarr

ay(), that will print the values of the array on the monitor. pass the array to a function, sortarray(), that will sort the array. Pass the array to printarray() again and print it in increasing order
Computers and Technology
1 answer:
slava [35]3 years ago
5 0

Answer:

In C++:

#include <cstdlib>  

#include <ctime>  

#include <iostream>

#include <bits/stdc++.h>

using namespace std;

void printarray(int array []){

for(int i=0; i<100; i++){         cout << array[i] << " ";    }

}

void sortarray(int array []){

sort(array, array + 100);

   printarray(array);

}

int main() {  

   int array[100];

   srand((unsigned)time(0));  

   for(int i=0; i<100; i++){  array[i] = (rand()%99);     }

   printarray(array);

   cout<<endl;

   sortarray(array);

   return 0;

}

Explanation:

<em>See attachment for program source file where comments are used for explanation purpose</em>

Download cpp
You might be interested in
____ are model building techniques where computers examine many potential solutions to a problem, iteratively modifying various
gregori [183]

Answer:

E. Genetic algorithms

Explanation:

In Computer science, Genetic algorithms are model building techniques where computers examine many potential solutions to a problem, iteratively modifying various mathematical models, and comparing the mutated models to search for a best alternative.

6 0
3 years ago
What is stored in a source file, an object file, and his executable file?
neonofarm [45]
A source file has source code, what a human understands. It isn't compiled or linked.

An object file has compiled, but not linked intermediary code.

An executable file has compiled and linked code which is executable.
6 0
3 years ago
You can separate words in a macro name by using the ____ character
Maru [420]
You can separate words in a macro name by using the underscore character.

A macro is considered as a small reusable computer program. It is efficient as it helps you save time by automating any repeated task.
In order to create a macro, you do not need to be an expert in programming, however, a little knowledge about it will help.

8 0
3 years ago
Read 2 more answers
For the following code, if the input is negative, make numitemsPointer be null. Otherwise, make numitemsPointer point to numitem
weeeeeb [17]

Answer:

The program to this question can be described as follows:

Program:

#include <stdio.h> //defining header file  

int main() //defining main method

{

int* numItemsPointer; //defining pointer variable

int numItems; //defining integer variable

scanf ("%d", &numItems); //input value from user end

if(numItems < 0) //defining if block to check value

{

   numItemsPointer = NULL; //assign value to null

   printf ("Items is negative\n"); //print message

}

else //else block

{

   numItemsPointer = &numItems; //holds address

   numItems = numItems * 10; //multiple by 10

   printf("Items: %d\n", *numItemsPointer); //print value

}

return 0;

}

Output:

99

Items: 990

Explanation:

In the above program two integer variable "numItemsPointer and numItems" is defined, in which numItemsPointer is a pointer variable and numItems is integer variable, in which we input value from the user end, and an if condition statement is used, that check and calculate the values, which can be described as follows:

  • In the if block a condition is defined that variable "numItems" is less then 0, if this condition is true so, inside the block, it will assign a value, that is equal to "NULL", and prints its value.
  • If the condition is not true it will go to the else block, in this block, it will first pointer variable holds the variable address, and multiply the value by 10, and prints pointer variable value.
7 0
3 years ago
Read 2 more answers
Write a function called PayLevel that returns a level given an Ssn as input. The level are: "Above Average" if the employee mak
kotykmax [81]

Answer:

Explanation:

Since no further information was provided I created the PayLevel function as requested. It takes the Ssn as input and checks it with a premade dictionary of Ssn numbers with their according salaries. Then it checks that salary against the average of all the salaries and prints out whether it is Above, Below, or Average. The output can be seen in the attached picture below.

employeeDict = {162564298: 40000, 131485785: 120000, 161524444: 65000, 333221845: 48000}

average = 68250

def PayLevel(Ssn):

   pay = employeeDict[Ssn]

   print("Employee " + str(Ssn) + " is:", end=" "),

   if pay > average:

       print("Above Average")

   elif pay < average:

       print("Below Average")

   else:

       print("Average")

PayLevel(161524444)

PayLevel(131485785)

7 0
2 years ago
Other questions:
  • Describe some advantages of a 64-bit versus 32-bit version of windows.
    9·1 answer
  • When did the digital revolution begin
    10·1 answer
  • One page of content in a PowerPoint presentation is referred to as a
    12·1 answer
  • Digital certificates can be used for each of these EXCEPT _____. A. to encrypt channels to provide secure communication between
    13·1 answer
  • Are the buying and selling of stocks centralized activities? Why or why not?
    10·2 answers
  • 3.3 Code Practice: Question 1
    15·1 answer
  • Is the wireless network you own as secure as it should be? Examine your wireless network or that of a friend or neighbor and det
    9·1 answer
  • The advantages of the dynamo
    15·1 answer
  • PLEASE HURRY I WILL GIVE BRAILIEST TO WHO EVER ANSWERS AND IS CORRECT
    14·2 answers
  • a. Describe how the student can use the jar of rice to model particle motion of a substance in each state of matter: solid, liqu
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!