संदेश

Control Statements लेबल वाली पोस्ट दिखाई जा रही हैं

Switch Case and Looping Statements in C++

चित्र
  switch . . . . . case Statement  यह एक Control Statement है | जब C++ program में हम अनेकों options apply करना चाहते हैं, तब switch . . . case statement का use करते हैं, इसीलिए इसे multiple choice statement भी कहा जाता है |  इस Statement का use करने के लिए एक variable में value input कराने के बाद उस variable को switch variable बना दिया जाता है, तथा switch statement के अंदर आवश्यकतानुसार विभिन्न cases define कर दिए जाते हैं | Program execution के दौरान compiler switch variable की value check करता है तथा variable की value से सम्बंधित case को execute कर देता है |   syntax: switch(variable) { case ...: ................. ................. case ...: ................. ................. case n: ................. ................. } * Program to print weekday: Output: Iteration जब C++ program में किसी विशेष statement को या program के किसी निश्चित part को बार बार repeat कराया जाता है, इस process को Iteration कहा जाता है |  Looping Statement  C++ program में Ite...

Control Statements in C++

चित्र
Control Statement  C++ Program में ऐसे statements, जो अन्य statements या program execution के flow को control या handle करते हैं, इन्हे Control Statements कहा जाता है |  दूसरे शब्दों में हम कह सकते हैं कि जिन Statements पर program के कुछ अन्य statements निर्भर करते हैं, उन्हें Control Statements कहा जाता है |  जैसे -  if . . . . . . else  nested if  ladder if  switch . . . . . . case  do . . . . . . .while  while  for  if . . . . else statement यह एक Conditional Statement होता है | जब हम C++ program में कोई Condition apply करना चाहते हैं, तब if . . . . else statement का use करते हैं |  इन Statement का use करने के लिए if के बाद parenthesis () लगाया जाता है तथा parenthesis के अंदर condition लिखी जाती है : if (condition) यदि parenthesis में लिखी हुई condition true होती है, तो if (condition) के बाद लिखे गए statement को execute किया जाता है तथा यदि condition false हो जाती है, तो program, if के बाद लिखे गए statement को jump कर जाता ह...