Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Defining and Using Enums | Enumerations in C++
Quizzes & Challenges
Quizzes
Challenges
/
C++ Structures and Enumerations

bookChallenge: Defining and Using Enums

Task

Swipe to start coding

Practice defining and using an enum to represent status values.

  • Define an enum named Status with the values Pending, InProgress, and Done.
  • Write a function isDone that takes a Status parameter and returns true if the status is Done, otherwise returns false.
  • Call the isDone function with each possible value of Status and print the results using this template: "Status: <status_value>, isDone: " Replace <status_value> with the name of the status, and <result> with either true or false.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 2
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

Awesome!

Completion rate improved to 8.33

bookChallenge: Defining and Using Enums

Swipe to show menu

Task

Swipe to start coding

Practice defining and using an enum to represent status values.

  • Define an enum named Status with the values Pending, InProgress, and Done.
  • Write a function isDone that takes a Status parameter and returns true if the status is Done, otherwise returns false.
  • Call the isDone function with each possible value of Status and print the results using this template: "Status: <status_value>, isDone: " Replace <status_value> with the name of the status, and <result> with either true or false.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 2
single

single

some-alt