What's Here?
Members: 136,933
Replies: 480,801
Topics: 74,948
Snippets: 2,567
Tutorials: 675
Total Online: 1,865
Members: 100
Guests: 1,765
Loading. Please Wait...
whats wrong?
whats wrong?, this program is a math trivia .i don't know what went wrong. b4 i
zanderela
17 Mar, 2008 - 07:25 AM
New D.I.C Head
Joined: 17 Mar, 2008
Posts: 5
#define p printf #define s scanf #define clr clrscr #define g gotoxy main() { int l; int y; for(;;) { clr(); g(32,9); p("MATH TRIVIA\n"); g(35,5);p("LOADING...\n"); for(y=20; y<60; y++) { g(y,6);p("ý"); delay(1000000);} clr(); g(37,2);p("Levels\n\n"); g(35,5);p("[1] QUESTIONS\n"); g(35,11);p("[2] QUIT\n\n"); g(33,15);p("Choose: "); s("%d",&l); if(l==1) easy(); else if (l==2) exit(); } } easy() { int x; char d[5]; int i=1; char a[]="a"; char b[]="b"; char c[]="c"; for(x=1;x<=3;x++) { clr(); g(22,9);p("Direction:"); g(22,11);p("1. What two letters are both symbols for 1,000?"); g(22,13);p("%s. K and M.",a); g(22,15);p("%s. A and B.",b); g(22,17);p("%s. L and D",c); g(22,21);p("Answer: ");gets(d); if(strcmp(d,a)==0) { clr(); g(22,25);p("Correct!!!\n"); g(22,27);p("Your scrore is %d",i); x=3; getch(); } else { g(22,25);p("Wrong!!!\n"); g(22,27);p("Life[%d]",x); getch(); } } for(x=1;x<=3;x++) { clr(); g(22,9);p("Direction:"); g(22,11);p("1. What's short for Binary Digit?"); g(22,13);p("%s. BD.",a); g(22,15);p("%s. Bit.",b); g(22,17);p("%s. Digit.",c); g(22,21);p("Answer: ");gets(d); if(strcmp(d,b)==0) { g(22,25);p("Correct!!!\n"); i=i+1; g(22,27);p("Your scrore is %d",i); x=3; getch(); } else { g(22,25);p("Wrong!!!\n"); g(22,27);p("Life[%d]",x); getch(); } } }
zanderela
RE: Whats Wrong? 17 Mar, 2008 - 07:49 AM
New D.I.C Head
Joined: 17 Mar, 2008
Posts: 5
sorry i did not know how to put this but here is my question. what seems to be the problem with my code.? before i put my choice of letter theres already a remark that my answer is wrong..Where did i go wrong? here is the code. :)
CODE
#define p printf #define s scanf #define clr clrscr #define g gotoxy main() { int l; int y; for(;;) { clr(); g(32,9); p("MATH TRIVIA\n"); g(35,5);p("LOADING...\n"); for(y=20; y<60; y++) { g(y,6);p("ý"); delay(1000000);} clr(); g(37,2);p("Levels\n\n"); g(35,5);p("[1] QUESTIONS\n"); g(35,11);p("[2] QUIT\n\n"); g(33,15);p("Choose: "); s("%d",&l); if(l==1) easy(); else if (l==2) exit(); } } easy() { int x; char d[5]; int i=1; char a[]="a"; char b[]="b"; char c[]="c"; for(x=1;x<=3;x++) { clr(); g(22,9);p("Direction:"); g(22,11);p("1. What two letters are both symbols for 1,000?"); g(22,13);p("%s. K and M.",a); g(22,15);p("%s. A and B.",b); g(22,17);p("%s. L and D",c); g(22,21);p("Answer: ");gets(d); if(strcmp(d,a)==0) { clr(); g(22,25);p("Correct!!!\n"); g(22,27);p("Your scrore is %d",i); x=3; getch(); } else { g(22,25);p("Wrong!!!\n"); g(22,27);p("Life[%d]",x); getch(); } } for(x=1;x<=3;x++) { clr(); g(22,9);p("Direction:"); g(22,11);p("1. What's short for Binary Digit?"); g(22,13);p("%s. BD.",a); g(22,15);p("%s. Bit.",b); g(22,17);p("%s. Digit.",c); g(22,21);p("Answer: ");gets(d); if(strcmp(d,b)==0) { g(22,25);p("Correct!!!\n"); i=i+1; g(22,27);p("Your scrore is %d",i); x=3; getch(); } else { g(22,25);p("Wrong!!!\n"); g(22,27);p("Life[%d]",x); getch(); } } }
zanderela
RE: Whats Wrong? 17 Mar, 2008 - 08:02 AM
New D.I.C Head
Joined: 17 Mar, 2008
Posts: 5
help. my code doesn't work propperly. everything seems to be good at first but by the time i key in my answer, theres already a remark that my answer is wrong. how can i remove it? and how can i put the score at the end of the game? thnx:)
CODE
#define p printf #define s scanf #define clr clrscr #define g gotoxy main() { int l; int y; for(;;) { clr(); g(32,9); p("MATH TRIVIA\n"); g(35,5);p("LOADING...\n"); for(y=20; y<60; y++) { g(y,6);p("ý"); delay(1000000);} clr(); g(37,2);p("Levels\n\n"); g(35,5);p("[1] QUESTIONS\n"); g(35,11);p("[2] QUIT\n\n"); g(33,15);p("Choose: "); s("%d",&l); if(l==1) easy(); else if (l==2) exit(); } } easy() { int x; char d[5]; int i=1; char a[]="a"; char b[]="b"; char c[]="c"; for(x=1;x<=3;x++) { clr(); g(22,9);p("Direction:"); g(22,11);p("1. What two letters are both symbols for 1,000?"); g(22,13);p("%s. K and M.",a); g(22,15);p("%s. A and B.",b); g(22,17);p("%s. L and D",c); g(22,21);p("Answer: ");gets(d); if(strcmp(d,a)==0) { clr(); g(22,25);p("Correct!!!\n"); g(22,27);p("Your scrore is %d",i); x=3; getch(); } else { g(22,25);p("Wrong!!!\n"); g(22,27);p("Life[%d]",x); getch(); } } for(x=1;x<=3;x++) { clr(); g(22,9);p("Direction:"); g(22,11);p("1. What's short for Binary Digit?"); g(22,13);p("%s. BD.",a); g(22,15);p("%s. Bit.",b); g(22,17);p("%s. Digit.",c); g(22,21);p("Answer: ");gets(d); if(strcmp(d,b)==0) { g(22,25);p("Correct!!!\n"); i=i+1; g(22,27);p("Your scrore is %d",i); x=3; getch(); } else { g(22,25);p("Wrong!!!\n"); g(22,27);p("Life[%d]",x); getch(); } } }
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month