Control Statements in C++ in Hindi

Introduction to various Control Statements and Programming Constructs in C++ in Hindi

If statement और इसके विभिन्न रूपों को जानने के लिए देखें—If Statements in C++

Control statements or programming constructs are those statements that determine order in which other statements of program are to be executed by computer. Generally execution of statements within program happens sequentially in order they are written. This execution starts from first statement of main and executing all statements stops at last statement of main. But in many cases we need not to execute all statements within main and we have to execute some statements or skip some statements or execute some statements more than once. In such cases we have to use control statements. There are following three types of control statements available in C++ Language:

Switch case statements के बारे में जानने के लिए देखें—Switch Statements in C++

Control statements या programming constructs उन statements को कहा जाता है जो यह निर्धारित करते है कि प्रोग्राम के अन्य statements किस क्रम में कम्प्यूटर के द्वारा execute होंगे। सामान्यतः प्रोग्राम में statements का execution उसी क्रम में होता है जिस क्रम में वे लिखे होते है। यह execution main के पहले statement से start होता है और सभी statements को execute करते हुए main के अंतिम statement पर stop होता है। किन्तु कई परिस्थितियों में  हमें main के सभी statements को execute नहीं करना होता है और कुछ statements को execute करना होता है या कुछ statements को छोड़ना होता है या कुछ statements को एक से अधिक बार execute करना होता है। ऐसी ही परिस्थिति में हमें control statements का प्रयोग करने की जरूरत पड़ती है। C++ Language में निम्नलिखित तीन प्रकार के control statements उपलब्ध है—

C++ के विभिन्न Looping statements और इसके प्रकारों को जानने के लिए देखें—Looping Statements in C++

Sequential Control Statements

Sequential control statements are executed by computer in same order as they are written in program. They are also called simple control statements.

Sequential control statements कम्प्यूटर के द्वारा उसी क्रम में execute किए  जाते है जिस क्रम में वे प्रोग्राम में लिखे होते है। इन्हें simple control statements भी कहा जाता है।

Selection Control Statements

Selection control statements helps computer to take a decision as to which statements are to be executed and which are to be skipped. They are also called decision control or branching statements.

Unconditional branching statements को जानने के लिए देखें—Break Continue and Goto

Selection control statements कम्प्यूटर को यह निर्णय लेने में सहायता करते है कि किन statements को execute करना है और किनको skip करना है। इन्हें decision control or branching statements भी कहा जाता है।

Repetition Control Statements

Repetition control statements helps computer to execute statements as many as times it needed. They are also called iteration control or looping statements.

Repetition control statements कम्प्यूटर को statements को जितने बार execute करने  की आवश्यकता है उतने बार execute करने में सहायता करते है। इन्हें  iteration control or looping statements भी कहा जाता है।

Control Statements in C++ in Hindi
Fig. Control Statements in C++

All control statements and programming constructs example programs in C++

  1. Absolute value of number (simple if)
  2. Checking odd or even number (if else)
  3. Checking leap year (if else)
  4. Greater in two numbers (if else)
  5. Finding grade from percent (else if ladder)
  6. Total percent and division (else if ladder)
  7. Greatest in three numbers (nested if)
  8. Simple calculator program (switch case single case)
  9. Switch between Mon to Sun (switch case single case)
  10. Checking vowel or consonant (switch case multiple case)
  11. Number of days in a month (switch case multiple case)
  12. Unconditional Branching (break continue and goto)
  13. Generate series of natural numbers (while, for, do while)
  14. Generate series of natural numbers and their sum
  15. Generate series of odd numbers and find their sum
  16. Generate series of even numbers and find their sum
  17. Generate table of given number
  18. Find factorial of given number
  19. Find power of given number
  20. Generate multiplication table of given number
  21. HCF and LCM of two numbers
  22. Generating Fibonacci series
  23. Checking prime number
  24. Generating series of prime numbers
  25. Sum of digits of given number
  26. Reverse of digits of given number
  27. Checking palindrome number
  28. Checking Armstrong number
  29. Generating series of Armstrong numbers
  30. Convert decimal to binary
  31. Convert binary to decimal
Share it to:

Published by

admin

I am a computer teacher, programmer and web developer