Why will this not work?

Sep 6, 2012 at 11:54am
one last problem then
1
2
3
4
5
6
7
8
9
10
11
if (result >= 0.5){
cout<<"you are too drunk to drive, you BAC is:"<<" "<<result<<endl;
cin.get();

}
else (result <0.5)
{cout << "you can drivee but be careful";
 }
 return 0;
}


will this work? also it cant compile because it says it expects a ";" before the {else
Sep 6, 2012 at 12:09pm
The else branch shouldn't have a condition.

Sep 6, 2012 at 12:12pm
Thank you :)
Sep 6, 2012 at 12:24pm
even with thecin.get()it still closes
Sep 6, 2012 at 12:48pm
Could you please post a preferably small, but compliable code which reproduces the problem?
Sep 6, 2012 at 2:28pm
if (result >= 0.5){
cout<<"you are too drunk to drive, you BAC is:"<<" "<<result<<endl;
cin.get();

}
else
{cout << "you can drive but be careful";
system(pause);
}

return 0;
}


this is the end of the program. so when i run the exe. and the result is bigger than or equal to 0.5 it works, but if its less than 0.5 it just close down.
Topic archived. No new replies allowed.