![]() |
|
#1
|
|||
|
|||
need a little helphere's a template for a class definition of a program,what i need is a way to do error checking on the initializer values for data members month,day and year.
CPP / C++ / C Code:
thanks a bunch guys. Last edited by LuciWiz : 01-Mar-2005 at 00:37.
Reason: Please insert your C++ code between [c++] & [/c++] tags
|
|
#2
|
|||
|
|||
nevermind got it..lolsorry guys.thought it was going to be desperate,but i was mistaken.got it done and all.here is the entire program in case somebody needs it.the code sets a date and increments days by one with account to date changes.
this program can be found in the lab accompanion book,of c++ how o program 4th edition,since it's the book i'm working with. CPP / C++ / C Code:
CPP / C++ / C Code:
CPP / C++ / C Code:
taddaaaa. have a nice day everybody. ![]() Last edited by LuciWiz : 01-Mar-2005 at 00:39.
Reason: Please insert your C++ code between [c++] & [/c++] tags
|
|
#3
|
|||
|
|||
|
Quote:
A good effort. However... In testing this I see a couple of issues: 1. Did you notice that all months have 30 days? (Look at fixit()) 2. In the constructor, you call setMo(), then setDay(), then setYear(). However , I see that setDay() calls isLeapYear(), which needs to know the year. (So call setYear() must be called before setDay()) Try initializing February 29 in a leap year, such as 2004, then a non-leap year, such as 2005 to see the result. You have certainly learned how to put a program together in C++. A few details that can be easily fixed, and you are ready for Bigger and Better things. Keep up the good work! Regards, Dave |
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The