madking153
In Runtime
- Messages
- 449
Iam a amature in programming ,I know the basic of C++ , so i need help in my homeworkls show me how to do it and explain.
iwill really appreciate.Below is the homework
//File date.h: class definition
class date {
int day;
int month;
int year;
public:
Date(); //sets to valid default date
void setDate(int d,int m,int y);
//sets to given date and corrects if necessary
void outputCout(); //outputs day/month /year to cout
// ...
private :
//....
};
//*************************************************
// File date.cpp : definitions of the member funtions of class date
#include"date.h"
//..... //member function definition
//*************************************************
// File main.cpp : test program for class Date
#include"date.h"
int main()
{
Date test;
test.setDate(31,12,2001);
test.outputCout();
//.......
return 0;
}
--------------------------------------------------------------------
The member functions are defined completely in the file date.cpp so that the main program run properly- also for other date values .Only the parts important for comprehension are shown; missing parts are indicated with comments .
Write the following member functions:
void monthBegin(); //alters date to the beginning of this month
void nextmonthBegin(); //alters date to the first of the next month
The following parts are required for both functions:
.declaration of the member functions in the class definition
.definition of the member function in the file date.cpp
.extension of the main program to test these 2 new member functions ,to be precise,each with 2 different date values that are present in the program
iwill really appreciate.Below is the homework
//File date.h: class definition
class date {
int day;
int month;
int year;
public:
Date(); //sets to valid default date
void setDate(int d,int m,int y);
//sets to given date and corrects if necessary
void outputCout(); //outputs day/month /year to cout
// ...
private :
//....
};
//*************************************************
// File date.cpp : definitions of the member funtions of class date
#include"date.h"
//..... //member function definition
//*************************************************
// File main.cpp : test program for class Date
#include"date.h"
int main()
{
Date test;
test.setDate(31,12,2001);
test.outputCout();
//.......
return 0;
}
--------------------------------------------------------------------
The member functions are defined completely in the file date.cpp so that the main program run properly- also for other date values .Only the parts important for comprehension are shown; missing parts are indicated with comments .
Write the following member functions:
void monthBegin(); //alters date to the beginning of this month
void nextmonthBegin(); //alters date to the first of the next month
The following parts are required for both functions:
.declaration of the member functions in the class definition
.definition of the member function in the file date.cpp
.extension of the main program to test these 2 new member functions ,to be precise,each with 2 different date values that are present in the program