Showing posts with label CPP Enum. Show all posts
Showing posts with label CPP Enum. Show all posts

Tuesday, March 15, 2016

Use enum to define a type called Response with the possible values Yes, No, and Maybe. Yes should be 1, No should be 0, and Maybe should be 2.

Leave a Comment

Question:

Use enum to define a type called Response with the possible values Yes, No, and Maybe. Yes should be 1, No should be 0, and Maybe should be 2.

Answer:

enum Response {No, Yes, Maybe};

Source:

C++ Primer Plus Sixth Edition Chapter Review

Read More