The C/C++ thread 63 replies

Please wait...

Sl4sh

UPGRADING TO PRO

50 XP

15th June 2006

0 Uploads

3,408 Posts

0 Threads

#11 9 years ago

hey man, why do you have to bring that up.

jesus fuck.




Andron Taps Forum Mod

Faktrl is Best Pony

261,840 XP

10th September 2007

4 Uploads

21,763 Posts

1,754 Threads

#12 9 years ago
Sl4sh;5174604Yeah, we get it man. You are a computer nerd.

Oh come on, that's basic stuff. And yes, I am ;)


"I'd shush her zephyr." ~ Zephyr.



Von II

aka noobst3R

50 XP

16th June 2008

0 Uploads

4,339 Posts

0 Threads

#13 9 years ago

computernerd;5174597:vikki:

It's really not that hard.

Example:

This is an easy program:

Spoiler: Show

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"); }

*Uses letters*




Sadim-Al-Bouncer

shaken - not stirred

50 XP

9th June 2009

0 Uploads

8,262 Posts

0 Threads

#14 9 years ago

I just split an atom.




book VIP Member

I'm a book!

48,335 XP

13th November 2002

15 Uploads

4,406 Posts

0 Threads

#15 9 years ago

i'm so impressed by your lack of a real life.




Sadim-Al-Bouncer

shaken - not stirred

50 XP

9th June 2009

0 Uploads

8,262 Posts

0 Threads

#16 9 years ago

I saw you the other day in my belly.




book VIP Member

I'm a book!

48,335 XP

13th November 2002

15 Uploads

4,406 Posts

0 Threads

#17 9 years ago

i wasn't talking to you




eezstreet

Lord of the .DCC files

50 XP

16th June 2008

0 Uploads

2,662 Posts

0 Threads

#18 9 years ago

#include #include #include #include #include

#ifndef EEZSTREETSPOST #include #endif

struct postinfo{ bool bookspost; bool bouncerspost; bool noobsterspost; bool sl4shspost; bool inyrispost; #ifndef EEZSTREETSPOST bool eezspost; #endif };

int main(postinfo pi){ postinfo pz; int isnoob; int isawesome; int isokay; printf("Now, let's see who's a noob."); if (pi == pz.bookspost || pi == pz.bouncerspost || pi == pz.noobsterspost || pi == pz.sl4shspost || pi == pz.inyrispost){ return isnoob; } #ifndef EEZSTREETSPOST else if(pi == pz.eezspost){ return isawesome; } #endif else{ return isokay; } }

I'm not the best at C++ however =Z




Von II

aka noobst3R

50 XP

16th June 2008

0 Uploads

4,339 Posts

0 Threads

#19 9 years ago

No u'r a noob.




Red Menace

SCHOFIELD DID 4/30

415,760 XP

10th August 2004

0 Uploads

40,364 Posts

1 Threads

#20 9 years ago

I got a C+ last quarter, I'm going to protest it to the professor.


sigpic82523_3.gif</div></body></html>