code for family feud game with one player and has 10 questions. It should be abl
ID: 3912850 • Letter: C
Question
code for family feud game with one player and has 10 questions. It should be able to accumulate scores and at the same time count the number of strikes. Two strikes halts the player from continuing to answer the questions. And his total score is printed out. code for family feud game with one player and has 10 questions. It should be able to accumulate scores and at the same time count the number of strikes. Two strikes halts the player from continuing to answer the questions. And his total score is printed out.Explanation / Answer
#include<stdio.h>
int main()
{
int a[10];
int strike=0,score=0;
for(i=0;i<10;i++)
if(a[i]==0)
score++;
else
strike++;
if(strike==2)
break;
}
return 0;
}
Explanation :
Note :If particular index is answered make that value to zero
u can make use the logic given above, since 10 questions, array of 10 is defined, and strike and score varaibles are intilized to zero, for loop runs for 10 times. and if matches to zero ,increment score else increment strike variable. If strike reaches to 2 then break from the loop.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.