if (q==s);
cout<<fixed<<setprecision(5)<<a*z<<endl;
else cout<<fixed<<setprecision(5)<<a*x<<endl;
error: else without a previous if
Thanks in advance
if (q==s);
cout<<fixed<<setprecision(5)<<a*z<<endl;
else cout<<fixed<<setprecision(5)<<a*x<<endl;
error: else without a previous if
Thanks in advance
That semi-colon shouldn't be there.Code:if (q==s);
If you understand what you're doing, you're not learning anything.
I fixed your thread title
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Compiler must generate an error in this case as else is being used without any if.
What compiler reading is;
It reads your if statement and as you didn't put any opening, closing bracket, so it reads ; as a statement and ignores remaining... It then takes cout object as a separate line and when it looks at else, it generates an error as there is no preceding if....
I don't care if someone doesn't like me, i was not put on earth to entertain everyone.
No King, no Queen, I am the ACE of battle.