Exercise 4.4

A user profile consists of a login, the actual user name, the number of times logged on, the number of guesses made, the number of correct guesses, the current level — one of beginner, intermediate, advanced, guru — and the percentage correct (this latter may be computed or stored). Provide a UserProfile class. Support input and output, equality and inequality. The constructors should allow for a default user level and default login name of “guest.” How might you guarantee that each guest login for a particular session is unique?

 class UserProfile { public: enum uLevel { Beginner, Intermediate, Advanced, Guru }; UserProfile( string login, uLevel = Beginner ); UserProfile(); // default memberwise initialization and copy sufficient ...

Get Essential C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.