-
Grand Future Air Dried Fresh Beef Dog Food
Air Dried Dog Food | Fresh Beef

Carnivore Diet for Dogs

Go Back   Automotive Forums Car Chat > Coffee Break (Off-Topic) > COMPLETELY off-topic
Register FAQ Community
COMPLETELY off-topic Talk about anything other than cars. But you can't be mad and angry in this forum!
Reply Show Printable Version Show Printable Version | Subscription Subscribe to this Thread
 
Thread Tools
  #1  
Old 10-16-2006, 11:14 PM
Dyno247365's Avatar
Dyno247365 Dyno247365 is offline
AF Enthusiast
 
Join Date: Jul 2005
Posts: 2,858
Thanks: 0
Thanked 0 Times in 0 Posts
C++ Need Help!!

I want to use a variable in a switch statement, is it possible?
Switch(total)
{
case whatever:
break;

case 2:
break;
}
doesn't work much.
__________________


1996 Dodge Ram 1500 5.2L 5spd!!!
1987 Chevy Iroc-Z- -Needs a new cat
1992 Nissan 240sx 5spd- SOLD
Reply With Quote
  #2  
Old 10-17-2006, 12:02 AM
Dyno247365's Avatar
Dyno247365 Dyno247365 is offline
AF Enthusiast
Thread starter
 
Join Date: Jul 2005
Posts: 2,858
Thanks: 0
Thanked 0 Times in 0 Posts
Re: C++ Need Help!!

umm this thread needs priority right now, can I use anything other than a case? Because it says it has to be a constant but I need to identify a VAR.
__________________


1996 Dodge Ram 1500 5.2L 5spd!!!
1987 Chevy Iroc-Z- -Needs a new cat
1992 Nissan 240sx 5spd- SOLD
Reply With Quote
  #3  
Old 10-17-2006, 12:59 AM
vinnym86's Avatar
vinnym86 vinnym86 is offline
AF Fanatic
 
Join Date: Sep 2005
Posts: 4,379
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to vinnym86
Re: C++ Need Help!!

you could use IF and ELSE statements. those are more basic than CASE statements, less versatile i think. sry, been a while since i've done qbasic and C++.
__________________
The most beautiful thing we can experience is the mysterious... He to whom this emotion is a stranger, who can no longer pause to wonder and stand to rapt in awe, is as good as dead: his eyes are closed.
Reply With Quote
  #4  
Old 10-17-2006, 02:25 AM
Dyno247365's Avatar
Dyno247365 Dyno247365 is offline
AF Enthusiast
Thread starter
 
Join Date: Jul 2005
Posts: 2,858
Thanks: 0
Thanked 0 Times in 0 Posts
Re: C++ Need Help!!

Quote:
Originally Posted by vinnym86
you could use IF and ELSE statements. those are more basic than CASE statements, less versatile i think. sry, been a while since i've done qbasic and C++.
I tried that already, for some reason it's telling me to declare Int For () which is really stupider than it even sounds. Maybe you know what i did wrong but I've already been told by a couple people to use if/else I just don't know why it won't work. I'm using Pico, let me try it again right now, PuTTy is great since I can get on my college's network!
__________________


1996 Dodge Ram 1500 5.2L 5spd!!!
1987 Chevy Iroc-Z- -Needs a new cat
1992 Nissan 240sx 5spd- SOLD
Reply With Quote
  #5  
Old 10-17-2006, 02:40 AM
Dyno247365's Avatar
Dyno247365 Dyno247365 is offline
AF Enthusiast
Thread starter
 
Join Date: Jul 2005
Posts: 2,858
Thanks: 0
Thanked 0 Times in 0 Posts
Re: C++ Need Help!!

I figured it out, it's a craps game program. I said that if the current total equals the total it got last time (temp_dice), it turns total into 0, which isn't one of the cases for a dice total, so I made case 0: for when you win the game. so that's the way i got it to work. It doesn't work yet but I believe it's right this way. Before I was using else for going into the switches and it didn't work.
__________________


1996 Dodge Ram 1500 5.2L 5spd!!!
1987 Chevy Iroc-Z- -Needs a new cat
1992 Nissan 240sx 5spd- SOLD
Reply With Quote
 
Reply

POST REPLY TO THIS THREAD

Go Back   Automotive Forums Car Chat > Coffee Break (Off-Topic) > COMPLETELY off-topic


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 06:16 PM.

Community Participation Guidelines | How to use your User Control Panel

Powered by: vBulletin | Copyright Jelsoft Enterprises Ltd.
 
 
no new posts