You really need to review the syntax of
if
blocks. My first recommendation is to
always use curly braces (i.e. { } ) for your
if
blocks (and loops as well). While it's not required for ones that contain a single line of statements in them, it makes it a lot easier to see what's going on, and easier to edit later if you decide to add more statements.
And yes, this is relevant, because right off the bat I notice a problem here:
else
cout << "Sum Of A & B Is Greater Then C" << endl;
{
if(C+A>B)
cout << "Sum Of C Is Greater Then B" << endl;
}
This probably doesn't do what you intended. If the
else
part is reached, then the line immediately after it is executed. Then you are no longer in the
else
block. The following
if
statement will always be executed, because it is not attached to the
else
, you have just created it in a different scope.
I'm not entirely sure what you meant to do there, but start by looking at that point.