|
I'm a beginner in C++!!
#1-Dont know how to loop end when int q(entered); int q is a very large # when ran: printf("\n%i#of Questions\n", q);
#2-is the line "how many questions Right"?
#3-Bypassing Welcome to the Multiple Choice Program, Goto Start; and ends when line for questions ((>= '1') && (<= '50')) is True!!
-Normally this would work, what am I doing wrong
// Program Q1:Q1.cpp
# include <iostream.h>
# include <stdio.h>
# include <string.h>
# include <conio.h>
main()
{
char name[30];
int n=0;
char c;
int q;
int sum;
int NG;
ASK:
printf ("Please enter the Number of Questions (1-50) ?\n", q);
scanf ("%i", q);
if ((q >= '1') && (q <= '50'))
{ printf ("Get Ready,(%s), !!!!!!\n",&name);
goto START;}
else
{ printf ("Invalid Entry, Try Again!!\n");
scanf ("%i", q);}
if ((q >= '1') && (q <= '50'))
{ printf ("Finally, (%s), it took you long enough,!!!\n", &name);
goto START;}
else
{ goto END_NOTEST;}
{START:
printf ("\nWelcome to the First Multiple Choice Test\n");
printf ("Created by Jonathan J. Soard, Oct 06\n");
TEST:
NG=0;
for(n=1;n < q;)
if (n != 'q')
{goto Q_1;}
else
{goto L_Q;}
{Q_1:
clrscr();printf("Q%i --------------#1?\n", n++);
printf("\n1.Bob");printf("\n2.Jon");printf("\n3.Ri ck");printf("\n4.Roger\n");scanf ("%s", &c);
if ((c == 'A'))
{printf("2 Good\n");
NG++;goto Q_2;}
{Q_2:
clrscr();printf("Q%i --------------#2?\n", n++);
printf("\n1.Bob");printf("\n2.Jon");printf("\n3.Ri ck");printf("\n4.Roger\n");scanf ("%s", &c);
if ((c == 'A'))
{printf("2 Good\n");
NG++;goto Q_3;}
{Q_3:
clrscr();printf("Q%i --------------#3?\n", n++);
printf("\n1.Bob");printf("\n2.Jon");printf("\n3.Ri ck");printf("\n4.Roger\n");scanf ("%s", &c);
if ((c == 'A'))
{printf("2 Good\n");
NG++;goto Q_4;}
{Q_4:
clrscr();printf("Q%i --------------#4?\n", n++);
printf("\n1.Bob");printf("\n2.Jon");printf("\n3.Ri ck");printf("\n4.Roger\n");scanf ("%s", &c);
if ((c == 'A'))
{printf("2 Good\n");
NG++;goto Q_5;}
{Q_5:
clrscr();printf("Q%i --------------#5?\n", n++);
printf("\n1.Bob");printf("\n2.Jon");printf("\n3.Ri ck");printf("\n4.Roger\n");scanf ("%s", &c);
if ((c == 'A'))
{printf("2 Good\n");
NG++;goto L_Q;}
{L_Q:
clrscr();printf("Q%i --------------#6?\n", n++);
printf("\n1.Bob");printf("\n2.Jon");printf("\n3.Ri ck");printf("\n4.Roger\n");scanf ("%s", &c);
if ((c == 'A'))
{printf("2 Good\n");
NG++;}
{print_1:
sum=NG/q * 1000;
printf("Answers Overview\n");
printf("Your answers---");
printf("\n%i#of Questions\n", q);
printf("\nGood Answers: %i", NG);
printf("\nAverage: %i" "%\n\n", sum);
goto END_NOTEST;
END_NOTEST:
printf ("Bye Bye (%s), Better Luck next time\n", &name);
}}}}}}}}}
|