1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <iomanip>
using namespace std;
//prototype section
void programInfo();
void inputList(double values[], int &count);
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;
int count = 0;
programInfo();
inputList(values, count);
printList(values, n, valuesPerLine);
// sortDescending(values, n);
// avgList(values, n);
// stdDev(values, n);
// medSortList(values, n);
// printStats(max, avg, std);
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 &count)
{
for (count = 0; count <= 20 - 1;)
{
cout << "Enter a value: " << endl;
cin >> values[count];
if (values[count] != -1)
{
count++;
}
else
{
break;
}
}
}
void printList(double values[], int n, int valuesPerLine)
{
int count = n;
for (count = 0; count <= n; count++)
{
cout << values[count];
}
}
|