Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include bool grade ( c h a r correctAnswers [ ] , char studentAnswers [ ] ) { int correctCount = 0 ; int incorrectCount
#include
bool grade correctAnswers char studentAnswers
int correctCount ;
int incorrectCount ;
for ; ;
studentAnswers
correctCount;
else
incorrectCount;
::cout "Congratulations!" ::endl;
::cout "You have passed the exam." ::endl;
::cout "Total number correct answers: correctCount ::endl;
::cout "Total number incorrect answers: incorrectCount ::endl;
return true;
else
::cout "Sorry, you have not passed the exam!" ::endl;
::cout "Total number correct answers: correctCount ::endl;
::cout "Total number incorrect answers: incorrectCount ::endl;
return false;
int main
char correctAnswers;
char studentAnswers;
int invalidInputCount ;
for ; ;
char answer;
::cout "Enter answer #:
;
::cin answer;
&& answer && answer && answer
::cout "Error! Only and are valid answers. Please try again." ::endl;
invalidInputCount;
::cout "GOODBYE" ::endl;
return ;
while && answer && answer && answer ;
studentAnswers answer;
grade studentAnswers;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started