1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <iostream>
using namespace std;
int main()
{
int num1, num2, month;
string months[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
cout << "Please enter two numbers seperated by a space, then press Enter, and the computer will tell you which number is greater." << endl;
cin >> num1 >> num2;
if (num1 > num2)
cout << num1 << " ""is greater than " << num2 << endl; //my if statements,
else if (num2 > num1)
cout << num2 << " ""is greater than " << num1 << endl;
else
cout << num1 << " ""is equal to " << num2 << endl;
cout << endl;
cout << "Now enter in a number from 1 - 12 and the program will tell you it's corresponding month. For example 5 = May." << endl;
cin >> month;
cout << endl;
if (month > 0 && month < 13)
{
cout << months[month] << " is the month." << endl;
}
else
{
cout << "You must enter a number between 1 and 12." << endl;
}
system ("pause");
return 0;
}
|