Sure, but look at this:
Indenttion is messed up because while is on the same level as the first if. And the second if is at the same level as the while. So indentation is messed up.Code:if (build=="1"||"build 1") {
(b=10); // inc. att. +5
(a=3); // inc. blo. +1
(d=9); // inc. secondary att. +4
(c=2); // inc. secondart blo. +0
(x=120); // inc. hp +20
while (x >= 1&&y >= 1) {
cout<<"do you want to hit or block "<<e1<<"? ";
cin>>answer;
if (answer=="hit") {
But you can also do:Quote:
You're right, it is a bit strange to see this type of initialization for primative types like int, but as for classes, I use constructor initialization as much as possible rather than assignment since it just seems like a waste to default construct an object and then change the state right afterwards.
Unless the constructor is explicit. It will still call the constructor.Code:MyObject obj = myvalue;
For objects, it's usually a little better, but yeah... it looks kind of messed up sometimes.

