Liberation Gaming is devoted to creating, editing, and improving the gaming experience.
 
HomePortalCalendarGalleryFAQSearchMemberlistUsergroupsRegisterLog in
Looking for site admins, to apply, post an application for site administration
The site continues to change, but the users discontinue to chat... keep posting people, come on!

Share | 
 

 Newbie help?

Go down 
AuthorMessage
legendman3
Follower
Follower


Posts : 23
Join date : 2010-06-06

PostSubject: 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;
}
Back to top Go down
View user profile
WARLOCK
Superadmin
Superadmin
avatar

Posts : 63
Join date : 2010-05-17
Age : 23
Location : Scotland (near Edinburgh)

PostSubject: 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

_________________
Back to top Go down
View user profile http://www.ukmandown.co.uk/
legendman3
Follower
Follower


Posts : 23
Join date : 2010-06-06

PostSubject: 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.
Back to top Go down
View user profile
WARLOCK
Superadmin
Superadmin
avatar

Posts : 63
Join date : 2010-05-17
Age : 23
Location : Scotland (near Edinburgh)

PostSubject: Re: Newbie help?   Fri Jun 18, 2010 2:46 pm

nope cause ive never written any C++ code in my life

_________________
Back to top Go down
View user profile http://www.ukmandown.co.uk/
legendman3
Follower
Follower


Posts : 23
Join date : 2010-06-06

PostSubject: Re: Newbie help?   Fri Jun 18, 2010 4:04 pm

Then why is this section here?
Back to top Go down
View user profile
WARLOCK
Superadmin
Superadmin
avatar

Posts : 63
Join date : 2010-05-17
Age : 23
Location : Scotland (near Edinburgh)

PostSubject: Re: Newbie help?   Fri Jun 18, 2010 4:11 pm

cause there are OTHER members and im sure someone knows C++

_________________
Back to top Go down
View user profile http://www.ukmandown.co.uk/
legendman3
Follower
Follower


Posts : 23
Join date : 2010-06-06

PostSubject: Re: Newbie help?   Fri Jun 18, 2010 9:38 pm

Cool hope they help me...
Back to top Go down
View user profile
The Liberator
Owner
avatar

Posts : 101
Join date : 2009-09-20
Age : 24
Location : Las Vegas, Nevada

PostSubject: 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.
Back to top Go down
View user profile http://Liberationgaming.com
legendman3
Follower
Follower


Posts : 23
Join date : 2010-06-06

PostSubject: Re: Newbie help?   Sat Jun 19, 2010 12:30 pm

Or you can put in comments \\
Back to top Go down
View user profile
GordonFreeman
Follower
Follower
avatar

Posts : 7
Join date : 2010-05-17
Age : 42
Location : Green Bay, WI

PostSubject: Re: Newbie help?   Wed Jun 30, 2010 3:48 pm

I am pretty good with C++, you need a if-then-else loop.
Back to top Go down
View user profile https://www.youtube.com/user/godlikemachinima
legendman3
Follower
Follower


Posts : 23
Join date : 2010-06-06

PostSubject: Re: Newbie help?   Wed Jun 30, 2010 6:19 pm

Thanks. But its kinda late for that.
Back to top Go down
View user profile
GordonFreeman
Follower
Follower
avatar

Posts : 7
Join date : 2010-05-17
Age : 42
Location : Green Bay, WI

PostSubject: Re: Newbie help?   Thu Jul 01, 2010 6:21 pm

Well you know who to ask if you have questions in the future.
Back to top Go down
View user profile https://www.youtube.com/user/godlikemachinima
Sponsored content




PostSubject: Re: Newbie help?   

Back to top Go down
 
Newbie help?
Back to top 
Page 1 of 1
 Similar topics
-
» newbie me:)
» Sorry....newbie here
» Hello, Newbie reporting to Guard Room !
» Newbie here to say hello
» Newbie to site not shore what doctor to use!

Permissions in this forum:You cannot reply to topics in this forum
Liberation Gaming HQ :: Development :: Coding (C++)-
Jump to: