classes exercise

I am pretty new to c++ and am learning from this sites tutorial pdf and other sources but i can't find any brain teasing exercises for classes with overloaded operators and
i think that at the moment if i try making a complex program with the use of classes i wont be able to because i didn't have any exercise with the advanced stuff.
So my question is, is there any list of class and overload operators brain teaser exercises on the site?
NOTE:my knowledge is all of the topics from the sites tutorial up to friendship and inheritance ( not included).

Last edited on
hello!
i understood the exercise but one line : >A "Date" structure.

you mean ?:
1
2
3
struct Date{
int value;
}year,month,day;


or just in a class as a private property:
1
2
3
4
5
class Date {
private:
int day,month,year;
public:
//all the other code here 
You could try overloading the << and the >> operator for input/output.

If you want an exercise about a date structure, try this:

Assume, there is a file wich holds temperature measure values.
Here is the file structure:
year:month:day:hour{measure},
Here an example of such a data file content:

2009:May:17:3{-7},2010:Jan:26:5{12},2009:Nov:30:19{10},

Your exercise is now:
Print the values of the file out to the screen, in a calendarian manner.

Hints:
Create a Day class, which holds the values with its hours,
then hold your days in a Month class, and the months in a Year class, then the years in a vector.

Overload the >> operator such, that you can write:
my_istream >> my_years_vector;
Overload the << operator such, that you are be able to write:
cout << day; cout << month; cout << year; cout << my_years_vector;
*edited
Last edited on
OK thanks for the exercises! i will get started now!
im also looking at the exercises because i was algo searching for something similar, thanks
Topic archived. No new replies allowed.