C++ experienced peeps chime in...
Make sure to use a bunch of do whiles.
__________________
2015 Ford Mustang GT Fastback - Ingot Silver - 6M - Performance Package - Gibson Catback, JLT CAI, FR 47lb injectors, BAMA E85 tune, Eibach Sportline, BMR wheel hop kit, UPR oil separator, Steeda shifter bushing/bracket
Team B.O.B.® - Ballaz on a Budget
2015 Ford Mustang GT Fastback - Ingot Silver - 6M - Performance Package - Gibson Catback, JLT CAI, FR 47lb injectors, BAMA E85 tune, Eibach Sportline, BMR wheel hop kit, UPR oil separator, Steeda shifter bushing/bracket
Team B.O.B.® - Ballaz on a Budget
#include <iostream>
using namespace std;
int main()
{
int num, min, max, n;
double mean, sum = 0, count;
cout << "Enter the amount of numbers to be calculated:" << endl;
cin >> n;
for (count = 0; count < 1; count++)
{
min = 0;
max = 0;
}
cout << " Enter a number to be calculated for minimum, maximum and mean. \n" << endl;
cin >> num ;
for (; num <= n ; num++)
{
if (num > max)
{
num = max;
}
if (num < min)
{
num = min;
}
else
sum += num;
mean = sum/n;
cout << "The maximum number is:" << max << endl;
cout << "\nThe minimum number is:" << min << endl;
cout << "\nThe mean number is:" <<mean<<endl;
}
return 0;
}
// i cant get the max and min to display.
//plus i cant get the for loop to stop at "n"
using namespace std;
int main()
{
int num, min, max, n;
double mean, sum = 0, count;
cout << "Enter the amount of numbers to be calculated:" << endl;
cin >> n;
for (count = 0; count < 1; count++)
{
min = 0;
max = 0;
}
cout << " Enter a number to be calculated for minimum, maximum and mean. \n" << endl;
cin >> num ;
for (; num <= n ; num++)
{
if (num > max)
{
num = max;
}
if (num < min)
{
num = min;
}
else
sum += num;
mean = sum/n;
cout << "The maximum number is:" << max << endl;
cout << "\nThe minimum number is:" << min << endl;
cout << "\nThe mean number is:" <<mean<<endl;
}
return 0;
}
// i cant get the max and min to display.
//plus i cant get the for loop to stop at "n"
do cout's after you set variables to ensure that they are getting stored properly. Double check that your loop control variable is what you want it to be and not just a random int.
Also, fix your declarations - at best its poor programming style to declare variables and only initialize some of them in the same line.
i.e.
int num, min, max, n;
double mean, sum = 0, count;
---
double mean, sum, count;
sum = 0;
Also, whats the purpose of this?
for (count = 0; count < 1; count++)
{
min = 0;
max = 0;
}
Its only going to run once.. why not just set the variables?
Also, fix your declarations - at best its poor programming style to declare variables and only initialize some of them in the same line.
i.e.
int num, min, max, n;
double mean, sum = 0, count;
---
double mean, sum, count;
sum = 0;
Also, whats the purpose of this?
for (count = 0; count < 1; count++)
{
min = 0;
max = 0;
}
Its only going to run once.. why not just set the variables?


