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 37 38 39
|
#include <iostream>
using namespace std;
int main ()
{
char answ, y, n;
int num;
int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// vv not sure what if I have this correct or not.vv
string month[] = {January, Febuary, March, April, May, June, July, August, September, October, November, December};
while(answ = y)
{
cout << "Enter a number between 1-12 ";
cin >> num;
if(num > 0 && num <= 12)
{
--num;
cout << month[num] << " has " << days[num] << endl;
cout << "would you like to continue?" << endl;
cout << "y or n" << endl;
cin >> answ;
}
else
{
cout << "please enter a number between 1-12\n\n" << endl;
continue;
}
}
system("pause");
return 0;
}
|