So I am supposed to make a calculator that calculate the mean, median, and standard deviation of a list of values. This is what I have so far. The program lets the user enter 20 values, but I don't how to get the sentinal loop to signal the end of entering data. Also, after entering the values I get a runtime error.
#include <iostream>
#include <string> //any string work include string library
using namespace std;
//prototype section
void programInfo();
void inputList(double values[], int MAX_HOURS);
//void printList(double values[], int n, int valuesPerLine);
void sortDescending(double values[], int n);
double avgList(double values[], int n);
//double stdDev(double values[], int n);
//double medSortList(double values[], int n);
//void printStats(double max, double avg, double std);
int main()
{
const int MAX_VALUES = 20;
double values[20];
int n = 0;
int valuesPerLine = 0;
double max = 0;
double avg = 0;
double med = 0;
double std = 0;
string again = "yes";
int count = 0;
int values1 = MAX_VALUES;
cout << "Do you want to run again? (yes or no)" << endl;
cin >> again;
}
cout << "Author: Edwin Trinh\n";
return 0;
}
//definitions section
void programInfo()
{
cout << "Edwin's statistical calculator." << endl;
cout << endl;
cout << "Please follow instruction carefully." << endl;
cout << "Enter a value at a time (at least 3 to up to 20)." << endl;
cout << "You must enter valid data or the program will not work." << endl;
cout << "Enter -1 to signal end of data (-1 or -1.0)." << endl;
cout << endl;
}
void inputList(double values[], int MAX_VALUES)
{
int values1 = MAX_VALUES;
So I got the sentinel loop to end the inputting data and print the values as well, except it is print out a bunch of weird values and not the ones that I input. Is there something wrong with my printList code?
#include <iostream>
#include <string> //any string work include string library
#include <cmath>
#include <cstdlib>
#include <iomanip>
using namespace std;
//prototype section
void programInfo();
void inputList(double values[], int MAX_HOURS);
void printList(double values[], int n, int valuesPerLine, int count);
//void sortDescending(double values[], int n);
//double avgList(double values[], int n);
//double stdDev(double values[], int n);
//double medSortList(double values[], int n);
//void printStats(double max, double avg, double std);
int main()
{
const int MAX_VALUES = 20;
double values[20];
int n = 0;
int valuesPerLine = 0;
double max = 0;
double avg = 0;
double med = 0;
double std = 0;
int count = 0;
int values1 = MAX_VALUES;
//definitions section
void programInfo()
{
cout << "Edwin's statistical calculator." << endl;
cout << endl;
cout << "Please follow instruction carefully." << endl;
cout << "Enter a value at a time (at least 3 to up to 20)." << endl;
cout << "You must enter valid data or the program will not work." << endl;
cout << "Enter -1 to signal end of data (-1 or -1.0)." << endl;
cout << endl;
}
void inputList(double values[], int MAX_VALUES)
{
int count = 0;