0

I need to create q&a project and I don't know how to handle scores when user gets the correct answer please help.

For example <p>what's the color of an orange?</p> <label>Orange<input type="checkbox">< /label> <label>white<input type="checkbox">< /label> <label>green<input type="checkbox">< /label> <label>blue<input type="checkbox">< /label>

2nd May 2021, 4:48 PM
Oliver Silas
Oliver Silas - avatar
1 Respuesta
+ 2
make two variables like correct_answer and wrong_answer, declare those two to 0. use an if-else statement to check whether the answer correct or not, if the answer is correct, then update the value by 1, like correct_answer += 1 and the same as wrong answer. kinda like how I did it in https://www.github.com/Rellotscrewdriver/Math-Loop-Quiz-Program/tree/master/main.cpp (check line 11, 12, 78 and 81)
2nd May 2021, 4:55 PM
Rellot's screwdriver
Rellot's screwdriver - avatar