class Date
{
Public:
Date( string )
{
setDate1( date );
}
void setMonth( string );
string getMonth();
void setDay( int );
void setYear( int );
void displayDate();
Also this is the main that he provided.
int main(){
//variables with assigned values, used for first instance of Date
int test_month = 15, test_day = 31, test_year = 2011;
//variables with values set from user input, used for second instance of Date
int user_month, user_day, user_year;
//setting up first instance of Date, date1:
Date date1(test_month, test_day, test_year);
cout<<"First date\n";
date1.displayDate(); //prints out date in mm/dd/yyyy format
cout<<"\nUser input for second date\n";
cout<<"Enter the month: ";
cin>>user_month; //take in user input for month
cout<<"Enter the day: ";
cin>>user_day; //take in user input for the day of month
cout<<"Enter the year: ";
cin>>user_year; //take in user input for year
Date date2(user_month, user_day, user_year);
cout<<"\nSecond date\n";
date2.displayDate();
//third instance of Date, using constants:
Date date3(2, 29, 2008);
cout<<"\nThird date, using constants\n";
date3.displayDate();
date3.setMonth(3);
date3.setDay(19);
date3.setYear(1988);
cout<<"\nThird date, after changes\n";
cout<<date3.getMonth()<<"/"<<date3.getDay()<<"/"<<date3.getYear();
system("PAUSE");
return 0;
}
This post has been edited by Martyr2: 05 February 2011 - 01:56 PM
Reason for edit:: Please use code tags in the future, thanks!

New Topic/Question
Reply




MultiQuote






|