can someone please tell me what is wrong with this program that it always outputs unknown mounth.
#include <iostream>
using namespace std;
int letter;
int second_letter;
int third_letter;
int main()
{
cout << " Enter one letter to identify the month: ";
cin >> letter;
switch(letter){
//cases for February
case 'f':
case 'F':
cout << " This month is February" << endl;
break;
//cases for September
case 's':
case 'S':
cout << " This month is September" << endl;
break;
//cases for October
case 'o':
case 'O':
cout << " This month is October" << endl;
break;
//cases for November
case 'n':
case 'N':
cout << " This month is November" << endl;
break;
//cases for December
case 'd':
case 'D':
cout << " This month is December" << endl;
break;
//cases for April or August
// promts for a second letter
case 'a':
case 'A':
cout <<" What is the second letter of the month: ";
cin >> second_letter;
switch (second_letter){
case 'p':
case 'P':
cout << " This month is April" << endl;
break;
case 'u':
case 'U':
cout << " This month is August" << endl;
}
break;
//cases for January
// promts for a second letter
case 'j':
case 'J':
cout <<" What is the second letter of the month: ";
cin >> second_letter;
switch (second_letter){
case 'a':
case 'A':
cout << " This month is January" << endl;
break;
//cases for July
//prompts for a thrird letter
case 'u':
case 'U':
cout << " What is the third letter:";
cin >> third_letter;
switch(third_letter){
case 'l':
case 'L':
cout << " This month is July" << endl;
break;
//cases for June
//prompts for a thrird letter
case 'n':
case 'N':
cout << " This month is June" << endl;
}}
break;
//cases for March
case 'm':
case 'M':
cout << " What are the next two letters: ";
cin >> second_letter >> third_letter;
switch(third_letter){
case 'r':
case 'R':
cout << " This month is March" << endl;
break;
case 'y':
case 'Y':
cout << " This month is May" << endl;
}
break;
code tags , sorry the cin object should go into err state since it will be type mismatch when you try to assign a character to int type, change letter to char type