Thread: C++ Help
View Single Post
Old 07-01-2009, 07:34 PM   #25 (permalink)
Oreo
 
010011010110000101111000

Join Date: Dec 2006

Location: Leicester, England

Posts: 3,660

Oreo will become famous soon enoughOreo will become famous soon enough

Send a message via MSN to Oreo
Default Re: C++ Help

Very odd problem. Me and my friends are just trying to make a console based game.

However, i have hit a very strange and confusing problem. After about 70 lines of code, i have a switch statement. However, i try to add two constants (i think they're called that..) that were defined earlier on outside the switch by console input, but the result is totally random and nothing like correct.

for example, outside the switch i have two constants, 'strength' and 'defence' they are both defined as 10 by console input just for testing. But if i try to define a new constant anywhere inside the switch like this:

total = strength + defence;
cout << total;

i get some extremely odd results. Such as 209, 204, 02.

I would paste the entire code but it's nearly 200lines long and some of it still needs sorting out.
Oreo is offline