Hello programmers,
I am trying to write a simple class, with a default constructor to output a date. All it has to do, is output the date "01/01/2013" (MM/DD/YYYY format). I'm compiling, and running, and getting output. However, the output is garbage data, the same data each time. What am I doing wrong?
Thank you :3Code:#include <iostream> using namespace std; class Date { private: int month; int day; int year; public: Date (int=01, int=01, int=2013); }; Date::Date(int d, int m, int y) { month=m; day=d; year=y; } int main() { int d; int m; int y; cout<<d<<"/"<<m<<"/"<<y; return 0; }



3Likes
LinkBack URL
About LinkBacks






Remember remember oct 31 is dec 25.