iostream and basic function only plz
Write a c++ program which declares an array which can hold 50
int values. Use a const to
establish the size of the array. Use a loop to fill the array with
50 random numbers. Then display the values 10 per line, like:
32734 11377 29730 25790 27662
31264 5530 7441
14377 21719
28059 27864
4276 1495 29687 12784 19497 31106 21525
22643
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{
const int size = 50;
//const int
int arr[size],i;
//array size of const
int
srand(time(NULL));
//creates new seed for
creating new random numbers
for(i=0;i<size;i++)
arr[i] = rand() % (50000-1000) +
1; //getting random numbers within range of max =
50000, min = 1000
for(i=0;i<size;i++)
{
cout << arr[i] << "
"; //printing
random numbers
if((i+1)%10==0)
//including new line after 10 elements in a row
cout <<
endl;
}
}
iostream and basic function only plz Write a c++ program which declares an array which can...
Three C Code Questions: 5. Write a C program that declares an array of 10 strings, each of max length 50 characters, and then reads an entire line of text from the keyboard into each string. 6. Write C code that finds the longest name in this array of strings that you read in Q5. Hint: find the position of the longest string, not the string itself. 7. Write a C program that creates a 4 x 6 two dimensional...
7eatng that function Write a C++ program that does the following: Fill an array of 123 elements using srand) and rand) with random numbers between 150 and 667. Fill an array of 123 elements with random numbers between 150 and 667. Using a loop. Fill an array of 123 elements with random numbers between 150 and 667. Using a for loop Use a void function to fill an array of 123 elements with random numbers between 150 and 667, Possible...
This program has an array of floating point numbers as a private data member of a class. The data file contains floating point temperatures which are read by a member function of the class and stored in the array. Exercise 1: Why does the member function printList have a const after its name but getList does not? Exercise 2: Fill in the code so that the program reads in the data values from the temperature file and prints them to...
Q2. Consider the following C++ program that declares, allocates and fills in a1D array with random numbers between 0 and 100. The array is sent to a function that finds the indices of all items > 50. A new array is created and the indices are stored inside it. The size of the new arrays MUST BE the same as the number of items > 50. The function returns the new array which is then printed out by main. Here...
I need a c++ code please. 32. Program. Write a program that creates an integer constant called SIZE and initialize to the size of the array you will be creating. Use this constant throughout your functions you will implement for the next parts and your main program. Also, in your main program create an integer array called numbers and initialize it with the following values (Please see demo program below): 68, 100, 43, 58, 76, 72, 46, 55, 92, 94,...
c++ show code thanks,
only use library <iostream>
Question 1 Write the following two functions The first function accepts as input a two-dimensional array of integers. It returns two results: the sum of the elements of the array and the average The second function accepts as input a two-dimensional array of integers and integer value V. It returns true if the value V is found in the array, false otherwise. Write a main program that declares and initializes the following...
C++. Write a program that copies the contents of one array into another array but in reverse order using pointers. - in main() - define 2 arrays of type int, 10 elements each - initialize one array with numbers 1 through 10 - initialize all elements of the second array to 0 - call function reverseCopy with both arrays as arguments - display the values of array number 2 (reversed order) - reverseCopy...
in C++ Write a program which uses the following arrays: empID: An array of 7 integers to hold employee identification numbers. The array should be initialized with the following values: 1, 2, 3, 4, 5, 6, 7. Hours: an array of seven integers to hold the number of hours worked by each employee. payRate: an array of seven doubles to hold each employee’s hourly pay rate. Wages: an array of seven doubles to hold each employee’s gross salary. The program...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....
Write a C program Design a program that uses an array to store 10 randomly generated integer numbers in the range from 1 to 50. The program should first generate random numbers and save these numbers into the array. It will then provide the following menu options to the user: Display 10 random numbers stored in the array Compute and display the largest number in the array Compute and display the average value of all numbers Exit The options 2...