Question: My C++ Program is not running. Please fix the erorrs: #include #include #include #include using namespace std; int main() { Srand(time(0)); // need this to
My C++ Program is not running. Please fix the erorrs:
#include
#include
#include
#include
using namespace std;
int main() {
Srand(time(0)); // need this to make random numbers different every time you run the program
int a[100],n,sum=0,max=0,min=101,rand();
cout << "How many numbers should be generated?:";
cin >> n;
cout<< " Numbers generated: "; //put n random numbers in array
for (int i=0; i
a[i]=rand()%100+1; // put random number in array
cout << a[i] << " " ; //prints this random number
sum+= a[i]; // add this random number to my sum
if (a[i]>max) max = a[i];//check if new max
if (a[i]>min)min = a[i];//check if new min
}
cout << endl;
double average = (double)sum/n;// now prints out result
cout << "Summary:" << endl;
cout << "Count:" << endl;
cout << "Sum:" << endl;
cout << "Average:" << endl;
cout << "Min:" << endl;
cout << "Max:" << endl;
return 0;
}
Also plz include the output of the program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
