Hello I'm fairly new to this site and I've just completed my first program,got it working to a point.My problem is that I can't divide my variables here's a sample of part of my program.
I'm using string
1 2 3 4
Average = scoreOne + scoreTwo + scoreThree / 3;
cout << "Average is " << Average << endl;
Right now I'm in class but will be posting the full program later tonite.
I will greatly appreciate any response from you guys also if you could reccomend some books and sites for videogame programming(C++) that be great.
Division has a higher precedence order than addition and is therefore computed first. Your formula is equivalent to scoreOne + scoreTwo + (scoreThree / 3)
What you meant was (scoreOne + scoreTwo + scoreThree) / 3
And if you're going to post anything longer than a few lines, for the love of God, use [code] tags.
You just put another tag between your [code] word so it won't be adentified as a keyword...
Example: [[b][/b]code]
(Duoas posted it here: http://www.cplusplus.com/forum/beginner/2831/ )
mikeb570: You'll want to use the [tt][/tt] tags, that will allow you to force monospace (and ASCII art will work without dots, just spaces):
Please Excuse My Dear Aunt Sally =)
a x u i d u
r p l v d b
e o t i i t
n n i s t r
t e p i i a
h n l o o c
e t i n n t
s s c i
i a o
s t n
i
o
n
Of course, you'll have to force monospace for text input fields... but I have that anyway... at least when using Camino. >_>
Edit: Helios: How would those zero width spaces work? Enlighten a poor n00b, pretty please ;)
Turn on Num Lock, hold Alt, then try pressing 8, 2, 0, 3 on the Numpad, then release Alt. You can do this to put in the decimal code for pretty much any symbol.