generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Variable Rage with C++

Previous Thread :: Next Thread 
geicogeko is not online. geicogeko
Joined: 27 Apr 2010
Total Posts: 2727
07 Jun 2012 10:52 AM
I assign a global variable in one function, I output it and it is correct, I output that variable in another function and it is one, I am going to guess I'm just stupid.
/rqF7E2rV

[::Legal Lizard::]
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
07 Jun 2012 10:56 AM
> 2012
> Global variables in c++
Report Abuse
geicogeko is not online. geicogeko
Joined: 27 Apr 2010
Total Posts: 2727
07 Jun 2012 11:04 AM
Pardon my stupidity.

[::Legal Lizard::]
Report Abuse
geicogeko is not online. geicogeko
Joined: 27 Apr 2010
Total Posts: 2727
07 Jun 2012 11:07 AM
I'm sure I am just missing something.

[::Legal Lizard::]
Report Abuse
IAmNotWise is not online. IAmNotWise
Joined: 28 Jul 2011
Total Posts: 1418
07 Jun 2012 11:10 AM
[ Content Deleted ]
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
07 Jun 2012 11:12 AM
>1. Why not use the entire std namespace

Why use entire std when you're only going to use cout and cin?
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
07 Jun 2012 11:16 AM
`if ((choice = 1) || (choice = 2))` is the cause of your problem. That assigns 1 to `choice`, which evaluates to true, which prevents C++ evaluating the next expression in the if (since `true || x` is always true). That is why `choice` is always 1.
Report Abuse
geicogeko is not online. geicogeko
Joined: 27 Apr 2010
Total Posts: 2727
07 Jun 2012 11:21 AM
Wow, derp derp derp. Trust me, I can code even worse, my last attempt at this would have left you wishing to has a spoon with which you could remove your eyes.

[::Legal Lizard::]
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
07 Jun 2012 11:48 AM
Heh. Well I did spend hours on a LNK2019 error the other day...

Turned out that it wasn't the code, but some obscure VS problem and all I had to do was recreate the file with the same code.
Report Abuse
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
07 Jun 2012 11:53 AM
I google my C++ errors that I do not recognize so I get a good idea of what is causing problems.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image