int main( int argc, const char* argv[] ){ //declare variables int day=NULL; DayOfYear a; char again='n'; do{ do{ //prompt for input cout<<"Please enter a day of the year. (1-365)\n"; cin>>day; }while(day > 365 || day < 1); //pass into class a.setNum(day); //print results a.print(); //repeat? cout<<"Again? (Y/N): "; cin>>again; }while(again == 'y' || again == 'Y'); return 0; }
int main(int argc, char** argv) { //declare variables int day; char leapQ; //leap year question DayOfYear info; //input day do{ cout<<"Is it a leap year this year? Type y if yes, n if no "<<endl; cin>>leapQ; leapQ=tolower(leapQ); if(leapQ!='y'&&leapQ!='n') cout<<"Invalid answer"<<endl; }while(leapQ!='y'&&leapQ!='n'); do{ cout<<"Enter a day of the year (out of 365)"<<endl; cin>>day; }while(day>366&&day<1); if(leapQ=='y') info.leapYear(day); else info.print(day); return 0; }