Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Combining Structs and Enums | Enumerations in C++
C++ Structures and Enumerations

bookChallenge: Combining Structs and Enums

Tâche

Swipe to start coding

Define a struct named Student that contains an enum Level with the values Freshman, Sophomore, Junior, Senior and a member variable level of type Level. Write a function named isSenior that takes a Student object as a parameter and returns true if the student's level is Senior, otherwise returns false. In the main function, create a Student with the level set to Senior and another with the level set to Junior. Print the result of calling isSenior for both students using the format: "Is the student a senior? {result}", where {result} is true or false.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 4
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

Awesome!

Completion rate improved to 8.33

bookChallenge: Combining Structs and Enums

Glissez pour afficher le menu

Tâche

Swipe to start coding

Define a struct named Student that contains an enum Level with the values Freshman, Sophomore, Junior, Senior and a member variable level of type Level. Write a function named isSenior that takes a Student object as a parameter and returns true if the student's level is Senior, otherwise returns false. In the main function, create a Student with the level set to Senior and another with the level set to Junior. Print the result of calling isSenior for both students using the format: "Is the student a senior? {result}", where {result} is true or false.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 4
single

single

some-alt