Saturday, September 6, 2014

CONDITIONAL STATEMENT



          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!";



30 comments:

  1. very nice presentation/..

    ReplyDelete
  2. Nice. I can do my assignment now. Thanks for the information. :)

    ReplyDelete
  3. Thanks to the blogger who do all the effort to do this blog. Such a great help. :)

    ReplyDelete
  4. Such a Beautiful blogger ^^

    ReplyDelete
  5. such a nice blog thanks

    ReplyDelete
  6. nice :) thanks sa info :)

    ReplyDelete
  7. What an AWESOME BLOG. Now I can do Programming by myself!
    THANKS.

    ReplyDelete
  8. good blog for information seekers and programmers!

    ReplyDelete
  9. di ko to talga gamay e .. kaya makakatulong to saken :)

    ReplyDelete
  10. the flowchart makes it clearer..

    ReplyDelete
  11. pls share this blog, its informative.
    also visit --- getelectrifiedwith.blogspot.com tnx :*

    ReplyDelete
  12. you can also visit my amazing, great, perfect, and beautiful blog..^^

    angkaalamanatkatotohanan.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!

    ReplyDelete
  13. nice blog... keep it up..

    ReplyDelete
  14. The presentation was successful because the topics that you've been teach will help us improve our programming skills .... Thank you mam
    :)

    ReplyDelete
  15. another statement i learned.. thanks for this blog!!

    ReplyDelete
  16. partly 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..

    ReplyDelete
  17. this post has a big role in programming.. thanks.

    ReplyDelete
  18. for programming problems that needs condition, this was advisable...

    ReplyDelete
  19. now i understand how to use this.. thank you for this,

    ReplyDelete
  20. Kinda tricky program.

    ReplyDelete
  21. i really learned a lot!

    ReplyDelete
  22. oh.. so that's how it works.
    tnx.

    ReplyDelete
  23. i also try to use this in my program...

    ReplyDelete
  24. very well explanation about conditional statement..
    thank you!

    ReplyDelete