Hi, guys I needed some help with this program I was told that in order to do the standard deviation I should put my grades in an array so I was wondering is there anyway that I can put the grades that the user inputs in Choice = 1 into Choice = 3 is there anyway to convert them into an array basically I only wanna use the array in Choice = 3 can someone guide me the to the right path Thanks =)
#include <iostream>
#include <math.h>
usingnamespace std;
void Display_Menu();
int main ()
{
Display_Menu();
int choice,grad,count,sum;
int min = 100;
int max = 0;
int average,diff;
cin >> choice;
while (choice != 'q')
{
if (choice == 1)
{
while (grad >= 0)
{
cout <<"Enter the necessary grades.\n";
cin >>grad;
if (grad >=0)
{
sum = sum + grad;
count++;
}
if (grad <min && grad > 0)
{
min = grad;
}
if (grad > max)
{
max = grad;
}
}
cout <<"Enter you're next choice.\n";
cin >> choice;
}
if (choice == 2)
{
average = sum/count;
cout << "This is the average of the grades entered.\n" << average << "\n";
cout << "Select you're next choice.\n";
cin >> choice;
}
if (choice == 3)
{
}
if (choice == 4)
{
cout << "This is the highest grade you entered.\n" << max << "\n";
cout << "This is the lowest grade you entered.\n" << min << "\n";
}
cout << "Goodbye see you next time.\n";
break;
}
system ("pause");
return 0;
}
void Display_Menu()
{
cout << " Option 1 : Enter grades ( Quit with a negative value)\n";
cout << " Option 2 : Display the Mean(average) for the grades\n";
cout << " Option 3 : Display the standard deviation for the grades\n";
cout << " Option 4 : Display the high and low grades\n";
cout << " Option 5 : Enter 'q' to quit\n";
cout << "Enter you're choice (1-5)\n";