| Newbie help? | |
|
|
Author | Message |
---|
legendman3 Follower
Posts : 23 Join date : 2010-06-06
| Subject: Newbie help? Fri Jun 18, 2010 9:20 am | |
| Well im new at C++ and im trying to make a program only stop if you enter the correct number. I made so that you can type anything(or not type at all) and the program will quit. I want it to only work if you enter the number 13. Heres my code its really basic. - Code:
-
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std;
int main(int nNumberofArgs, char* pszArgs[]) { int magic; cout << "You lost the game, now type the magic number:"; cin >> magic; system("PAUSE"); return 0; } | |
|
| |
WARLOCK Superadmin
Posts : 63 Join date : 2010-05-17 Age : 29 Location : Scotland (near Edinburgh)
| Subject: Re: Newbie help? Fri Jun 18, 2010 2:32 pm | |
| well it doesnt actually say 13 in the code and i think that would need to be their as a reference to the correct input | |
|
| |
legendman3 Follower
Posts : 23 Join date : 2010-06-06
| Subject: Re: Newbie help? Fri Jun 18, 2010 2:45 pm | |
| Well can you give me a part of the code that i need to make it work? I knew there was no 13 in the code. | |
|
| |
WARLOCK Superadmin
Posts : 63 Join date : 2010-05-17 Age : 29 Location : Scotland (near Edinburgh)
| Subject: Re: Newbie help? Fri Jun 18, 2010 2:46 pm | |
| nope cause ive never written any C++ code in my life | |
|
| |
legendman3 Follower
Posts : 23 Join date : 2010-06-06
| Subject: Re: Newbie help? Fri Jun 18, 2010 4:04 pm | |
| Then why is this section here? | |
|
| |
WARLOCK Superadmin
Posts : 63 Join date : 2010-05-17 Age : 29 Location : Scotland (near Edinburgh)
| Subject: Re: Newbie help? Fri Jun 18, 2010 4:11 pm | |
| cause there are OTHER members and im sure someone knows C++ | |
|
| |
legendman3 Follower
Posts : 23 Join date : 2010-06-06
| Subject: Re: Newbie help? Fri Jun 18, 2010 9:38 pm | |
| Cool hope they help me... | |
|
| |
The Liberator Owner
Posts : 101 Join date : 2009-09-20 Age : 29 Location : Las Vegas, Nevada
| Subject: Re: Newbie help? Sat Jun 19, 2010 9:56 am | |
| Bleh, give me a bit, I'm going to re-write your code a bit, ill put in the () so you know what I changed and why. () = Thoughts in coding and have no effect on the code itself. | |
|
| |
legendman3 Follower
Posts : 23 Join date : 2010-06-06
| Subject: Re: Newbie help? Sat Jun 19, 2010 12:30 pm | |
| Or you can put in comments \\ | |
|
| |
GordonFreeman Follower
Posts : 7 Join date : 2010-05-17 Age : 48 Location : Green Bay, WI
| Subject: Re: Newbie help? Wed Jun 30, 2010 3:48 pm | |
| I am pretty good with C++, you need a if-then-else loop. | |
|
| |
legendman3 Follower
Posts : 23 Join date : 2010-06-06
| Subject: Re: Newbie help? Wed Jun 30, 2010 6:19 pm | |
| Thanks. But its kinda late for that. | |
|
| |
GordonFreeman Follower
Posts : 7 Join date : 2010-05-17 Age : 48 Location : Green Bay, WI
| Subject: Re: Newbie help? Thu Jul 01, 2010 6:21 pm | |
| Well you know who to ask if you have questions in the future. | |
|
| |
Sponsored content
| Subject: Re: Newbie help? | |
| |
|
| |
| Newbie help? | |
|