Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Defining and Using Enums | Enumerations in C++
C++ Structures and Enumerations

bookChallenge: Defining and Using Enums

Opgave

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.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 2
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

Awesome!

Completion rate improved to 8.33

bookChallenge: Defining and Using Enums

Stryg for at vise menuen

Opgave

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.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 2
single

single

some-alt