Hi all, I have one last problem for my C++ class and I can't figure this one out, please help in any way you can!!!
I need to return a random number from array n= {19, 50, 78, 161, 252}, loop it 1000 times and print the frequency of the 5 numbers obtained. Heres what I have so far.
const int n=5, ntimes=1000;
int freq[n]={0};
short int rndSeq[]={19,50,78,161,252};
printRand (freq[], rndSeq[], ntimes);
//main for loop to create random sequence
//this is what I can't seem to set up correctly!
//results
cout<<rndSeq[i]<<"occurred "<<
freq[i]<<" times."<<endl;
Sample output
19 occured 2055 times
50 occured 1986 times
78 occured 1962 times
161 occured 2079 times
252 occured 1919 times
I wish I could provide more code, but nothing I create makes an sense in the for loops that I am doing.
Please help!
Thanks!