Below is the code Ive come up with so far. Sorry if its not as pretty as others, Im new to this board and still working on it!
Any way,what Im having trouble figuring out is what I need to do next which is take these 10 questions and when you are done answering them I need to tally up the number right, the number wrong and display a grade.
Any tips would be greatly appreciated!!!
Thanks
Code:
/* Programming in C FINAL PROJECT */
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
char Q1;
char Q2;
char Q3;
char Q4;
char Q5;
char Q6;
char Q7;
char Q8;
char Q9;
char Q10;
int c,w;
main()
{
printf ("1-What is 1 + 1?\nA=1\nB=2\nC=3\nD=4\n");
scanf ("%c", &Q1);
if ((Q1 == 'B')||(Q1 == 'b'))
{c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
system ("pause");
system ("cls");
printf ("2-What is 2 + 2?\nA=4\nB=2\nC=6\nD=8\n");
scanf ("%s", &Q2);
if ((Q2 == 'A')||(Q2 == 'a'))
c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
system ("pause");
system ("cls");
printf ("3-What is 4 + 4?\nA=2\nB=6\nC=8\nD=9\n");
scanf ("%s", &Q3);
if ((Q3 == 'C')||(Q3 == 'c'))
{c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
system ("pause");
system ("cls");
printf ("4-What is 4 + 7?\nA=2\nB=6\nC=2\nD=7\n");
scanf ("%s", &Q4);
if ((Q4 == 'D')||(Q4 == 'd'))
{c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
system ("pause");
system ("cls");
printf ("5-What is 1 + 3?\nA=2\nB=4\nC=3\nD=7\n");
scanf ("%s", &Q5);
if ((Q5 == 'B')||(Q5 == 'b'))
{c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
system ("pause");
system ("cls");
printf ("6-What is 1 + 6?\nA=7\nB=6\nC=5\nD=10\n");
scanf ("%s", &Q6);
if ((Q6 == 'A')||(Q6 == 'a'))
{ c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
system ("pause");
system ("cls");
printf ("7-What is 3 + 9?\nA=8\nB=18\nC=17\nD=12\n");
scanf ("%s", &Q7);
if ((Q7 == 'D')||(Q7 == 'd'))
{c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
system ("pause"); /* Start FIXING FROM HERE */
system ("cls");
printf ("8-What is 3 + 9?\nA=8\nB=18\nC=17\nD=12\n");
scanf ("%s", &Q7);
if ((Q7 == 'D')||(Q7 == 'd'))
{ c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
system ("pause");
system ("cls");
printf ("7-What is 3 + 9?\nA=8\nB=18\nC=17\nD=12\n");
scanf ("%s", &Q7);
if ((Q7 == 'D')||(Q7 == 'd'))
{c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
system ("pause");
system ("cls");
printf ("7-What is 3 + 9?\nA=8\nB=18\nC=17\nD=12\n");
scanf ("%s", &Q7);
if ((Q7 == 'D')||(Q7 == 'd'))
{ c=c+1;
printf ("Correct Answer\n");
}
else
{
w=w+1;
printf ("Wrong Answer\n");
}
return 0;
}