Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help getting my code to display the values of argc and argv, the list of

ID: 3527280 • Letter: I

Question

I need help getting my code to display the values of argc and argv, the list of scores provided, one per line, each score labeled with score[i], and the highest and lowest score. /* a.out number-of-scores(K) score1 score2 ... scoreK */ #include #include // exit() and atoi() functions #include #include using namespace std; // Maximum number of scores to use const int SIZE = 30; int main(int argc, char *argv[]) { int numOfScores; // number of scores to read and process float scores[SIZE];// array of scores int i; // array index float sum; // sum of all the scores float average; // average of all the scores float sdv; // standard deviation // check the provided command line arguments if (argc < 2) { cerr << "Too few command line arguments." << endl; cerr << "Run the program with :" << "a.out number-of-scores(K) score1 score2 ... scoreK"<< endl; exit(-1); } else // there are at least 2 command line arguments provided { numOfScores = atoi(argv[1]); // if there are less than specified number of scores provided, terminate the program if (argc < numOfScores+2) { cerr << "Not enough scores provided." << endl; cerr << "Run the program with :" << "a.out number-of-scores(K) score1 score2 ... scoreK"<< endl; exit(-1); } else // command line has at least K scores provided { // store the scores in the scores array for (i=0; i 0) // prevent division by zero average = sum/numOfScores; // You may add other routines here to: // (1) sort the scores // (2) compute other statistics, i.e., standard deviation. float total; total = 0; for (i=0;i<< "Total " << numOfScores << " scores." << endl; if (numOfScores > 0) // prevent underfined value or NAN to be displayed { cout << "Average is:" << setprecision(2) << average << endl; cout << "standard deviation is" << stdev << endl; } return 0; }

Explanation / Answer

PLEASE RATE ME AND AWARD ME KARMA POINTS IF IT IS HELPFUL FOR YOU www.gnu.org/software/gsl/manual/gsl-ref.html

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote