This is a programming language
statement that selects an execution path based on whether some condition is
true or false.
IF/ ELSE STATEMENT
Using if/ else, one block of code is
executed if the control expression is true and another block is executed if the
control expression is false.
ex.
if (x==100)
cout<<"x is 100";
else
cout<<"x is not 100";
The
if else structures can be concatenated with the intention of verifying a range
of value.
ex.
if (x>0)
cout<<"x is positive";
else if (x<0)
cout<<"x is negative";
else
cout<<"x is 0";
NESTED IF/ ELSE
Nesting If/ else statement means that you put
another if/ else
statement
within the true side or false side of another if/else statement.
Here is an example program:
int grade,income;
cout<<"Enter grade of Students: ";
cin>>grade;
cout<<"Enter Monthly Income: ";
cin>>income;
if(grade>=85)
{
if(income<=10000)
cout<<"Qualified!!";
else
cout<<"Not Qualified!";
}
else
cout<<"Not Qualified!";
Here is an example program:
int grade,income;
cout<<"Enter grade of Students: ";
cin>>grade;
cout<<"Enter Monthly Income: ";
cin>>income;
if(grade>=85)
{
if(income<=10000)
cout<<"Qualified!!";
else
cout<<"Not Qualified!";
}
else
cout<<"Not Qualified!";

very nice presentation/..
ReplyDeleteIt's a very helpful lecture. :)
ReplyDeleteNice. I can do my assignment now. Thanks for the information. :)
ReplyDeleteThanks to the blogger who do all the effort to do this blog. Such a great help. :)
ReplyDeleteSuch a Beautiful blogger ^^
ReplyDeletesuch a nice blog thanks
ReplyDeleteNice me :)
ReplyDeletenice :) thanks sa info :)
ReplyDeleteWhat an AWESOME BLOG. Now I can do Programming by myself!
ReplyDeleteTHANKS.
good blog for information seekers and programmers!
ReplyDeletenice :)
ReplyDeleteIt helps me a lot! Thanks :)
ReplyDeletedi ko to talga gamay e .. kaya makakatulong to saken :)
ReplyDeletenice 1.. Good
ReplyDeletethe flowchart makes it clearer..
ReplyDeletepls share this blog, its informative.
ReplyDeletealso visit --- getelectrifiedwith.blogspot.com tnx :*
you can also visit my amazing, great, perfect, and beautiful blog..^^
ReplyDeleteangkaalamanatkatotohanan.blogspot.com
by the way.. i really love your blog.. it is nice that the other peopl like you gives so much attention to this topic.. good job!
nice blog... keep it up..
ReplyDeleteThe presentation was successful because the topics that you've been teach will help us improve our programming skills .... Thank you mam
ReplyDelete:)
another statement i learned.. thanks for this blog!!
ReplyDeletepartly related to my blog.. but based on what ive read, this function is more effective than the switch one.. but they still are amazing functions in a program..
ReplyDeletethis post has a big role in programming.. thanks.
ReplyDeletefor programming problems that needs condition, this was advisable...
ReplyDeletenow i understand how to use this.. thank you for this,
ReplyDeletegood job. :D
ReplyDeleteKinda tricky program.
ReplyDeletei really learned a lot!
ReplyDeleteoh.. so that's how it works.
ReplyDeletetnx.
i also try to use this in my program...
ReplyDeletevery well explanation about conditional statement..
ReplyDeletethank you!