Due date: Specified on the Blackboard Please submit: 1. Flowchart of your progra
ID: 3686956 • Letter: D
Question
Due date: Specified on the Blackboard Please submit: 1. Flowchart of your program. (4 points) 2. Printout of your C++ program with a heading comment (Do not forget to add comments within your program). (4 points) 3. Copy of a screenshot after your program is executed. (2 points) 4. You must use a 2 dimensional array in order to receive any credit. ELEN 1301-48F Programming Assignment #11. Name Your name Student ID Your student ID Due date Purpose of the program: Create a program that generates random numbers, store them in a 10 X 10 array, and find the average for each row, column, as well as whole numbers Section 1 set a random number seed with 2 followed by the last 3 digits of your student ID. Section 2 Generate random numbers each ranging from 0 to 9. and store them in a 10 x 10 array. Section 3 Calculate the average for each row column and whole. Section 4 Show the result to the screen. Averages must show 2 digits below the decimal point Output examples 5 1 5 7 6 6.00 3.40 7 6 1 8 9 2 7 9 5.80 2.90 1 5.70 6.10 3.80 4.70 5.7 4.90 90 2.20 4.60 5.20 3.60 4.50 3.80 5.10 6.00 4.48 to continueExplanation / Answer
#include <iostream>
#include<time.h>
#include<iomanip>
using namespace std;
const int size=10;
int main()
{
int a[10][10];
double total,avg,tsum;
srand(2);
for(int i=0;i<size;i++)
{
total=0;avg=0.0;
for(int j=0;j<size;j++)
{
a[i][j]=rand()%10;
cout<<a[i][j]<<" ";
total+=a[i][j];
tsum+=a[i][j];
}
avg=total/3;
cout<<fixed<<setprecision(2)<<avg<<endl;
}
int j=0;
while(j<size)
{
total=0;avg=0;
for(int i=0;i<size;i++)
{
total+=a[i][j];
}
avg=total/size;
cout<<fixed<<setprecision(2)<<avg<<" ";
j++;
}
cout<<tsum/size*size;
cout<<endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.