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).
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:
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