76.0k views
5 votes
Connect 5 LEDs with any random colors. Iteratively, turn ON 1 to 5 LED(s) that will take 5 iterations in total, and in every iteration ask the user "How many LEDs are ON?". At the end of the completion of all iterations, display in the output "Correct answers: a%". For example, if a user’s answers are correct to none of the 5 questions, then display "Correct answers: 0%"; If a user’s answers are correct to 1 question, then display "Correct answers: 20%"; If a user’s answers are correct to 2 questions, then display "Correct answers: 40%"; and so on.

User Bheklilr
by
5.6k points

1 Answer

1 vote

Answer:

See explaination for program code.

Step-by-step explanation:

C++ programming language is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on.

C++ supports different ways of programming like procedural, object-oriented, functional, and so on. This makes C++ powerful as well as flexible.

Please kindly refer to attachment for a C++ programming code that performs the operation.

Connect 5 LEDs with any random colors. Iteratively, turn ON 1 to 5 LED(s) that will-example-1
User Hampo
by
6.6k points