for my assignment we need to create a code that generates
- n number of random numbers (from 0-100) and store them in an array
- then we have to ask the user a question if they want to see the numbers in the array
- then ask the user if they want to see the numbers in the array in order from 0-100
- then ask the user if they want to see the histogram of the data set
- finally, ask the user if they want to see the number of data in the array, the max, the min, the standard deviation, average, variance.
I am however, finding it hard for the program to display the numbers of the array if the user says y the question (AKA step 2)
Any help is great
int main()
{
int numb=0;
int *newar=NULL;
char response;
cout << "enter integer:";
cin >> numb;
newar = new int [numb];
for(int i=0;i<numb;i++)
{
newar[i]=rand() % 101;
cout << "Do you want to see array? (Y/N) :";
cin>> response;
if (response != 'n')
{
cout<<newar[i]<<" ";
}
}
return 0;
}
i, make a new loop with its own counter.