Question
C++ ( Can you expline to me this is code from the begining to the END that is it and thanks /****************************************************************************** The C++ program
C++ (
Can you expline to me this is code from the begining to the END
that is it
and thanks
/****************************************************************************** The C++ program read a number (max 100) from user. Generate that many number randomly. Then find the mean and standard deviation of the numbers *******************************************************************************/
#include #include
using namespace std;
//forward declaration of the functions double findMean(int numbers[], int size); double findStdDev(int numbers[], int size); void printNumbers(int numbers[], int size);
int main() { int size; //Read total number from user (upto 100) //If user enters any number which is less than 1 or greter than 100 //it will promt user to enter again do{ cout<<"Enter total number (max 100):"; cin>>size; if(size < 1 || size > 100) cout<<"Invalid size.Try again.."; }while(size < 1 || size > 100); int numbers[size]; //declare numbers array of length = size //Take numbers from user cout< for(int i = 0 ; i < size ; i++){ // numbers[i] = rand()%100; //generate random int within 100 cin>>numbers[i]; } //print the numbers in console printNumbers(numbers,size); //calculate mean of the numbers double mean = findMean(numbers,size); cout< for(int i = 0; i < size; i++){ cout< } }
//Function: findMean //It will take a numbers array and size //and calculate and return the mean of the numbers double findMean(int numbers[], int size){ double sum = 0; for(int i = 0; i < size; i++){ sum = sum + numbers[i];//calculate sum of all numbers } double mean = sum/size;//find the mean return mean; }
//Function: findStdDev //It will take a numbers array and size //and calculate and return the standard deviation of the numbers double findStdDev(int numbers[], int size){ double mean = findMean(numbers,size);//get the mean double sum = 0;//this will hold the running sum of the numerator part for(int i = 0; i < size; i++){ sum += pow((numbers[i]-mean),2); //(number[i]-mean)^2 } double stdDev = sqrt(sum/size);//calculate the standard deviation return stdDev; }
i want your explanations more and well
thanls
each line
what does it mean ,,, from line 11 to the line 36
can you expline to me
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started