Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ menu help pls

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Mon Apr 30, 2007 3:04 am    Post subject: C++ menu help pls Reply with quote

I am trying to make a program with a menu so i can select different optionso perform calculations

I'm trying to make it so if you enter 1 you go to option one and so on

_________________
Back to top
View user's profile Send private message
FullyAwesome
I post too much
Reputation: 0

Joined: 05 Apr 2007
Posts: 4438
Location: Land Down Under

PostPosted: Mon Apr 30, 2007 3:14 am    Post subject: Reply with quote

um u tried using the if, else syntax? i'm still learning C++ atm but a basic if loop should do it shouldn't it? for example.... try this script i just made up... i might have screwed up the synatx a lil but just try something like this and rep me if it works xD or if u use the "use namespace std" thingy for cout and cin do it ur way

Code:
#include <iostream>

int main() {

int option;

std::cout << "Press 1 for "option 1", press 2 for "option 2".
std::cin >> option


if (option = 1) {
//Do this....
}

if (option = 2) {
//Do this...
}

else {
//Do instead
}

//W.E else xD

return 0;

}


hope this helps xD[/code]

_________________
Back to top
View user's profile Send private message MSN Messenger
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Mon Apr 30, 2007 5:44 am    Post subject: Reply with quote

thanks for that but when i tried that it seemed to go to the option =1 code first, ill try it again
_________________
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Apr 30, 2007 5:57 am    Post subject: Reply with quote

of course it did, he used "=" which assigns 1 to option instead of "==" which compares 1 to option
Back to top
View user's profile Send private message
Robotex
Master Cheater
Reputation: 0

Joined: 05 Sep 2006
Posts: 378
Location: The pizza country!

PostPosted: Mon Apr 30, 2007 6:31 am    Post subject: Reply with quote

i would use
switch(option)
{
case 1:
etc
case 2:
etc
default:
etc
}
in this case

_________________

ASM/C++ Coder
Project Speranza lead developer
Back to top
View user's profile Send private message
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Mon Apr 30, 2007 12:53 pm    Post subject: Reply with quote

Robotex wrote:
i would use
switch(option)
{
case 1:
etc
case 2:
etc
default:
etc
}
in this case

Don't forget your breaks.

_________________

Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
Back to top
View user's profile Send private message
FullyAwesome
I post too much
Reputation: 0

Joined: 05 Apr 2007
Posts: 4438
Location: Land Down Under

PostPosted: Tue May 01, 2007 2:08 am    Post subject: Reply with quote

appalsap wrote:
of course it did, he used "=" which assigns 1 to option instead of "==" which compares 1 to option


yah sorry appalsap is right, i meant to put == when i was writing it but i was a lil unsure...but yah = assigns a value or w.e

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites