I am trying to display the highest and lowest numbers of the user input. this is what i have so far. the program so far outputs some other bits of info btw.
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
double jan, feb, march, april, may,
june, july, aug, sept, oct, nov, dec,
year, average;
cout << "How many days did it rain in January?";
cin >> jan;
cout << "How many days did it rain in Febuary?";
cin >> feb;
cout << "How many days did it rain in March?";
cin >> march;
cout << "How many days did it rain in April?";
cin >> april;
cout << "How many days did it rain in May?";
cin >> may;
cout << "How many days did it rain in June?";
cin >> june;
cout << "How many days did it rain in July?";
cin >> july;
cout << "How many days did it rain in August?";
cin >> aug;
cout << "How many days did it rain in September?";
cin >> sept;
cout << "How many days did it rain in October?";
cin >> oct;
cout << "How many days did it rain in November?";
cin >> nov;
cout << "How many days did it rain in December?";
cin >> dec;
cout << "\n";
year = jan + feb + march + april + may + june + july + aug + sept + oct + nov + dec;
cout << "The total amount of rainfall for the year was " << year << " days." << endl;
cout << "\n";
average = year / 12;
cout << "The average monthly rainfall was " << average << " days." << endl;
cout << "\n";
The logic is pretty simple imagine the first input number is always the largest then store it in a variable, then compare say the variable against every variable if it is bigger allocate the value to the variable again:
Then do the opposite for the smallest, instead of getting if bigger do if smaller allocate the value to variable.
I also have a question, why post this in Windows section, this does not use any Windows API functions learn to post it in correct section.
Next put code tags around the code. Next I will be damn sure this is a one time account.
Your Logic is very bad, it is below average, you must improve it.