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
|
#include <iostream>
#include <string>
using namespace std;
const int SENTINEL = -1;
void errorCheck (int, int, int, int&, int&, int&);
void year (int, int&);
void month (int, int, int&);
void day (int, int, int, int&);
void weekday (int, int, int, int);
int main ()
{//1
int m=0, d=0, y, total=0;
int errorm=0, errord=0, errory=0;
while (m != SENTINEL)
{//20
cout << "Enter random 2-digit month and day and a 4-digit year." << endl;
cout << "For example: 10 05 1989, then press enter." << endl;
cin >> m >> d >> y;
cout << endl;
errorCheck (m, d, y, errorm, errord, errory);
if (!errorm && !errord && !errory)
{//3
year (y, total);
month (m, y, total);
day (d, m, y, total);
weekday (m, d, y, total);
}//3
}//2
system("pause");
return 0;
}//1
|