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

Write a program that generates an array filled up with random positive integer

Computers and Technology
1 answer:
Scilla [17]3 years ago
8 0

Answer:

#include <iostream>

#include <cstdlib>  

using namespace std;

const int MIN_VALUE = 15;

const int MAX_VALUE = 20;

void fillArray(int arr[], int n) {

// fill up the array with random values

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

 arr[i] = rand() % (MAX_VALUE - MIN_VALUE + 1) + MIN_VALUE;

}

}

void displayArray(int arr[], int n) {

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

 cout << i << ": " << arr[i] << endl;

}

}

void main()  

{  

int myArray[10];

int nrElements = sizeof(myArray) / sizeof(myArray[0]);

fillArray(myArray, nrElements);

displayArray(myArray, nrElements);

char choice;

do {

 cout << "[P]osition [R]everse, [A]verage, [S]earch, [Q]uit ";

 cin >> choice;

 choice = toupper(choice);

 switch (choice) {

 case 'P':

  displayArray(myArray, nrElements);

  break;

 }

} while (choice != 'Q');

}

Explanation:

Here's a start. Now can you do the rest? ;-)

You might be interested in
Memory and processor both have big impact on the performance of a pc. <br>•true <br>•false <br>​
meriva

Answer:

true

Explanation:

they really do

the memory saves

while the processor determine the speed of the computer .... The processor also determine the price is the pc as it is the brain of the computer

4 0
3 years ago
C++ please
Nat2105 [25]

Answer:

#include <iostream>

#include <cstdlib>

#include <ctime>

using namespace std;

int main(){

   int n;

   cout<< "Enter the row and column length: ";

   cin>> n;

   int array_one[n][n];

   int array_transpose[n][n];

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

      for (int j= 0; j < n; j++){

           srand((unsigned) time(0));

           array_one[i][j] = (rand() % 4000)

           array_transpose[j][i] = array_one[i][j];

       }

   }

}

Explanation:

The C source code has three variables, 'array_one', array_transpose' (both of which are square 2-dimensional arrays), and 'n' which is the row and column length.

The program loops n time for each nth number of the n size to assign value to the two-dimensional array_one. the assign values to the array_transpose, reverse the 'i' and 'j' values to the two for statements for array_one to 'j' and 'i'.

7 0
3 years ago
Question #2
Bezzdna [24]
Computational thinking inclines invokes the techniques of decomposition, latter reconstruction, abstraction & algorithms development
3 0
3 years ago
Read 2 more answers
Intellectual ______ is the legal term for ownership of intangible assets such as ideas, art, music, movies, and software.
77julia77 [94]

Answer:

<u>Property</u>

Explanation:

Intellectual Property (IP) is the lawful protection of human idea/intellect by unauthorised users. These human intellects are intangible assets that have both moral and commercial value. They include ideas, art, music, movies, software e.t.c.

Common types of Intellectual property include

  • Copyrights
  • patents
  • Trade Marks
  • Trade Secrets
6 0
3 years ago
Read 2 more answers
g Create a program that prompts a user to enter a login name and password. The correct login name is Admin, and the correct pass
frutty [35]

Answer:

Answered below.

Explanation:

//Program in Python

login_name = "Admin"

password = "PASS"

display = " "

user_login_name = input ("Enter username: ")

user_password = input("Enter your Password: ")

if user_login_name == login_name and user_password == password:

display = "Correct Login"

elif user_login_name != login_name:

display = "wrong username"

elif user_password != password:

display = "wrong password"

print(display)

7 0
3 years ago
Other questions:
  • You are the IT security administrator for a small corporate network. Samuel Garcia (sgarcia) has been away on vacation and has f
    9·1 answer
  • Which of the following is a goal of paraphrasing and summarizing?
    14·2 answers
  • Does anyone know in adobe photoshop , digital design class , how to make a smart object and copy it to another page!
    6·1 answer
  • Which of the following is an electronic device, operating under the control of instructions stored in its own memory, that can a
    6·1 answer
  • Write an expression using membership operators that prints "Special number" if special_num is one of the special numbers stored
    12·1 answer
  • Can someone help me with my homework?
    7·1 answer
  • Ask the user to input an integer. Print out the next three consecutive numbers.
    14·2 answers
  • Text and graphics that have been out of copied are stored in area called the _____
    15·2 answers
  • Which of the following identifies the most appropriate courses to take in high school for someone interested in becoming a mecha
    9·1 answer
  • Very few games have any sort of narrative, not even a simple one that involves setting the mood through color, sound, environmen
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!