help. my program displays all "if" outputs and not just one. I can't find answers on web either.
#include <iostream>
using namespace std;
int main()
{
double month1;
double month2;
double month3;
double rainfall1;
double rainfall2;
double rainfall3;
double avg;
cout << "input a month. 1 is January, 2 is February and so on..." << endl;
cin >> month1;
if (month1 = 1) {
cout << "input rainfall for January" << endl;
}
if (month1 = 2) {
cout << "input rainfall for February" << endl;
}
if (month1 = 3) {
cout << "input rainfall for March" << endl;
}
if (month1 = 4) {
cout << "input rainfall for April" << endl;
}
if (month1 = 5) {
cout << "input rainfall for May" << endl;
}
if (month1 = 6) {
cout << "input rainfall for June" << endl;
}
if (month1 = 7) {
cout << "input rainfall for July" << endl;
}
if (month1 = 8) {
cout << "input rainfall for August" << endl;
}
if (month1 = 9) {
cout << "input rainfall for September" << endl;
}
if (month1 = 10) {
cout << "input rainfall for October" << endl;
}
if (month1 = 11) {
cout << "input rainfall for November" << endl;
}
if (month1 = 12) {
cout << "input rainfall for December" << endl;
}