void main() { printf("Welcome to the C/C++ thread; I don't expect it will last longer than 5 mins, but it's worth a shot, so post in C and C++ code"); }
"I'd shush her zephyr." ~ Zephyr.
void main() { printf("lolwut"); } ______
#include
main() { printf("Learn to program ;)"); }
"I'd shush her zephyr." ~ Zephyr.
#include
main() { printf("icanhazcopypaste. I accidentally'd in da code. :("); }
/thread
^My code is better than yours.
#include
main() { printf("She borked it"); } ___________
:vikki:
It's really not that hard.
Example:
This is an easy program:
main() { char ch; delay(); printf("\nWELCOME TO MATH TEST DEMO: DO YOU WANT TO PLAY? Y or N "); /* This is the main title screen */ printf("\n*WARNING: USE ONLY NUMBERS, DO NOT USE LETTERS AS THEY CAUSE THE PROGRAM TO CRASH."); ch = getche(); if (ch == 'y') Play(); /* If the user enters y, then this will go to the start menu. */ else Exit(); /* If user enters n or any other key, the program will terminate. */ }
Play() /* The start screen. */ { char ch; delay(); printf("\n\nPress the 's' key to start the game or press any other key to exit: "); ch = getche(); delay(); if ( ch == 's' ) /* Player must enter 's' to start. */ { delay(); Start(); } else Exit(); /* Or press any other key to terminate program. */ }
Start() { int ch; printf("\n\nHello, and welcome to TITUS ANDRONICUS THE DEMO, please enter the difficulty you want to play on: "); scanf("%d", &ch); if (ch==12345) Exit(); else if (ch==1) { delay(); printf("\n\nYou've chosen EASY"); easydif(); } else if (ch==2) { delay(); printf("\n\nYou've chosen MEDIUM"); meddif(); } else if (ch==3) { delay(); printf("\n\nYou've chosen HARD"); harddif(); } }
easyquest1() /* This is the first easy question. */ { int num1; printf("\n\nWhat is 2 plus 2? "); scanf("%d", &num1); { if (num1 == 4) { delay(); easycorrect1(); } else if (num1==12345) Exit(); else printf("\nThat is incorrect"); delay(); easyquest1(); } }
easyquest2() /* This is the second easy question. */ { int num1; printf("\n\nWhat is 5 plus 3? "); scanf("%d", &num1); { if (num1 == 8) { delay(); easycorrect2(); } else if (num1==12345) Exit(); else { delay(); printf("\nThat is incorrect"); } delay(); easyquest2(); } }
easyquest3() /* This is the third easy question. */ { int num1; printf("\n\nWhat is 22 minus 9? "); scanf("%d", &num1); { if (num1 == 13) { delay(); easycorrect3(); } else if (num1==12345) Exit(); else { delay(); printf("\nThat is incorrect"); } delay(); easyquest3(); } }
medquest1() /* This is the first medium question. */ { int num1; printf("\n\nWhat is 50 minus 30? "); scanf("%d", &num1); { if (num1 == 20) { delay(); medcorrect1(); } else if (num1==12345) Exit(); else { delay(); printf("\nThat is incorrect"); } delay(); medquest1(); } }
medquest2() /* This is the second medium question. */ { int num1; printf("\n\nWhat is 60 minus 15? "); scanf("%d", &num1); { if (num1 == 45) { delay(); medcorrect2(); } else if (num1==12345) Exit(); else { delay(); printf("\nThat is incorrect"); } delay(); medquest2(); } }
medquest3() /* This is the third medium question. */ { int num1; printf("\n\nWhat is 100 minus 50? "); scanf("%d", &num1); { if (num1 == 50) { delay(); medcorrect3(); } else if (num1==12345) Exit(); else { delay(); printf("\nThat is incorrect"); } delay(); medquest3(); } }
hardquest1() { int num1; printf("\n\nWhat is 500 - 359? "); scanf("%d", &num1); { if (num1 == 141) { delay(); hardcorrect1(); } else if (num1==12345) Exit(); else { delay(); printf("\nThat is incorrect"); } delay(); hardquest1(); } }
hardquest2() { int num1; printf("\n\nWhat is the square root of 144? "); scanf("%d", &num1); { if (num1 == 12) { delay(); hardcorrect2(); } else if (num1==12345) Exit(); else { delay(); printf("\nThat is incorrect"); } delay(); hardquest2(); } }
hardquest3() { int num1; printf("\n\nWhat is square root of 144 plus 40? "); scanf("%d", &num1); { if (num1 == 52) { delay(); hardcorrect3(); } else if (num1==12345) Exit(); else { delay(); printf("\nThat is incorrect"); } delay(); hardquest3(); } }
easydif() { easyquest1(); }
easycorrect1() /* If the first easy question is answered correctly, this variable takes user to the second question. */ { printf("\nThat is correct"); easyquest2(); }
easycorrect2() /* If the second easy question is answered correctly, this variable takes user to the final easy question. */ { printf("\nThat is correct"); easyquest3(); }
easycorrect3() /* If the third easy question is answered correctly, this variable takes user to the Medium difficulty. */ { printf("\nThat is correct, now let's try something a little harder"); meddif(); }
meddif() { medquest1(); }
medcorrect1() { printf("\nThat is correct"); medquest2(); }
medcorrect2() { printf("\nThat is correct"); medquest3(); }
medcorrect3() { printf("\nThat is correct, now lets move on to some harder questions"); harddif(); }
harddif() { hardquest1(); }
hardcorrect1() { printf("\nThat is correct"); hardquest2(); }
hardcorrect2() { printf("\nThat is correct"); hardquest3(); }
hardcorrect3() { char ch; printf("\nTHANK YOU FOR PLAYING THIS DEMO, THE FULL VERSION WILL BE FINISHED SOON."); printf("\n\nPRESS 'x' TO EXIT, OR PRESS 's' TO RESTART THE GAME."); ch = getch(); if (ch=='x') Exit(); else if (ch=='s') Start(); else hardcorrect3(); }
Exit() { exit (1); }
delay() { int k; printf("\x7"); for (k=1; k<9000 ; k++) ; printf("\x7"); }
"I'd shush her zephyr." ~ Zephyr.
Yeah, we get it man. You are a computer nerd.
Your face is a computer nerd.