Illegal else without matching if, but I have an if after else. :( And how can I round off the results? I mean, if it shows 4.5 it would display 5 and if it's 4.5 it would display 4? Please help me. :(((
vyalineconstantino
0
Newbie Poster
Recommended Answers
Jump to PostAnd how can I round off the results? I mean, if it shows 4.5 it would display 5 and if it's 4.5 it would display 4? Please help me.
ceil() and floor() functions will result in what you want.
lets see the example :-
cout<<floor(4.5);
it will round …
Jump to PostConsider lines 36-42
line 37 belongs to the if (no curly braces used)
So the else if on line 42 will give you an error.
I ALWAYS use curly braces, even if my if else if constructs only contain one line.
All 5 Replies
kvahanyan
0
Newbie Poster
sepp2k
378
Practically a Master Poster
rishif2
57
Posting Whiz in Training
vyalineconstantino
0
Newbie Poster
ddanbe
2,724
Professional Procrastinator
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.