Control Structure कंट्रोल स्ट्रक्चर:
A control structure is a statement or group of statements used to control the flow of execution in a program. It determines the order in which instructions are executed inside a program. Control structures help programmers combine instructions into logical units and make programs more organized, efficient, and easy to understand.
कंट्रोल स्ट्रक्चर वह स्टेटमेंट या स्टेटमेंट्स का समूह होता है जिसका उपयोग प्रोग्राम के एक्सीक्यूशन के प्रवाह को नियंत्रित करने के लिए किया जाता है। यह निर्धारित करता है कि प्रोग्राम में निर्देश किस क्रम में चलेंगे। कंट्रोल स्ट्रक्चर प्रोग्राम को व्यवस्थित, प्रभावी तथा समझने में आसान बनाते हैं।
Control structures are very important in structured programming because they help in decision making, repetition of tasks, and maintaining proper execution flow inside the program.
स्ट्रक्चर्ड प्रोग्रामिंग में कंट्रोल स्ट्रक्चर का बहुत महत्व है क्योंकि ये निर्णय लेने, कार्यों की पुनरावृत्ति करने तथा प्रोग्राम के सही प्रवाह को बनाए रखने में सहायता करते हैं।
There are mainly three types of control structures used in programming languages.
प्रोग्रामिंग लैंग्वेज में मुख्य रूप से तीन प्रकार के कंट्रोल स्ट्रक्चर उपयोग किए जाते हैं।
Sequential Structure सीक्वेंशियल स्ट्रक्चर
Selection Structure सिलेक्शन स्ट्रक्चर
Iterative Structure इटरेटिव स्ट्रक्चर
1. Sequential Structure सीक्वेंशियल स्ट्रक्चर:

In Sequential Structure, statements are executed one after another in the same order in which they are written. No statement is skipped and each statement is executed only once during program execution. This is the simplest type of control structure.
सीक्वेंशियल स्ट्रक्चर में स्टेटमेंट्स को उसी क्रम में एक के बाद एक एक्सीक्यूट किया जाता है जिस क्रम में वे लिखे गए होते हैं। किसी भी स्टेटमेंट को छोड़ा नहीं जाता तथा प्रत्येक स्टेटमेंट केवल एक बार एक्सीक्यूट होता है। यह कंट्रोल स्ट्रक्चर का सबसे सरल प्रकार है।
The working process of sequential structure is straightforward. The program starts from the first statement and continues step by step until the last statement is executed.
सीक्वेंशियल स्ट्रक्चर की कार्य प्रक्रिया बहुत सरल होती है। प्रोग्राम पहले स्टेटमेंट से शुरू होकर चरणबद्ध तरीके से अंतिम स्टेटमेंट तक पहुँचता है।
For example, a simple interest program first accepts principal, rate, and time values, then calculates interest, and finally displays the result.
उदाहरण के लिए साधारण ब्याज के प्रोग्राम में पहले मूलधन, दर और समय लिया जाता है, फिर ब्याज की गणना की जाती है और अंत में परिणाम प्रदर्शित किया जाता है।
Sequential structure improves program readability and is mainly used for simple calculations and basic programs.
सीक्वेंशियल स्ट्रक्चर प्रोग्राम की पठनीयता को बेहतर बनाता है तथा मुख्य रूप से सरल गणनाओं और बेसिक प्रोग्राम्स में उपयोग किया जाता है।
2. Selection Structure सिलेक्शन स्ट्रक्चर:

Selection Structure is used to select a particular statement or block of statements based on a condition. If the condition is true, the selected statement is executed; otherwise, it is skipped or another block is executed.
सिलेक्शन स्ट्रक्चर का उपयोग किसी कंडीशन के आधार पर विशेष स्टेटमेंट या स्टेटमेंट्स के समूह को चुनने के लिए किया जाता है। यदि कंडीशन ट्रू होती है तो संबंधित स्टेटमेंट एक्सीक्यूट होता है अन्यथा उसे छोड़ दिया जाता है या दूसरा ब्लॉक एक्सीक्यूट होता है।
Selection structures are mainly implemented using if statement, if-else statement, nested if, conditional operator, and switch case statement.
सिलेक्शन स्ट्रक्चर को मुख्य रूप से if स्टेटमेंट, if-else स्टेटमेंट, nested if, conditional operator तथा switch case स्टेटमेंट की सहायता से लागू किया जाता है।
The working process of selection structure starts with condition checking. The program evaluates the condition and then decides which block of code should be executed.
सिलेक्शन स्ट्रक्चर की कार्य प्रक्रिया कंडीशन की जाँच से शुरू होती है। प्रोग्राम पहले कंडीशन को जाँचता है और फिर तय करता है कि कौन सा कोड ब्लॉक एक्सीक्यूट होगा।
For example, in an even-odd number program, if the number is divisible by 2 then the program displays “Even”, otherwise it displays “Odd”.
उदाहरण के लिए सम-विषम संख्या प्रोग्राम में यदि संख्या 2 से विभाजित हो जाती है तो प्रोग्राम “Even” प्रदर्शित करता है अन्यथा “Odd” प्रदर्शित करता है।
Selection structure is very useful in decision-making programs such as result systems, login systems, grading systems, and menu-driven applications.
सिलेक्शन स्ट्रक्चर निर्णय आधारित प्रोग्राम्स जैसे रिजल्ट सिस्टम, लॉगिन सिस्टम, ग्रेडिंग सिस्टम तथा मेनू-ड्रिवन एप्लिकेशन में बहुत उपयोगी होता है।
3. Iterative Structure इटरेटिव स्ट्रक्चर:

इटरेटिव स्ट्रक्चर का उपयोग तब किया जाता है जब किसी स्टेटमेंट समूह को बार-बार एक्सीक्यूट करना हो जब तक कि दी गई कंडीशन फाल्स न हो जाए। इसे रिपीटीटिव स्ट्रक्चर या लूप स्ट्रक्चर भी कहा जाता है।
Iterative structures are implemented using loops such as while loop, for loop, and do-while loop.
इटरेटिव स्ट्रक्चर को while loop, for loop तथा do-while loop की सहायता से लागू किया जाता है।
The working process of iterative structure begins with condition checking. If the condition is true, the statements inside the loop are executed repeatedly. The loop stops automatically when the condition becomes false.
इटरेटिव स्ट्रक्चर की कार्य प्रक्रिया कंडीशन की जाँच से शुरू होती है। यदि कंडीशन ट्रू होती है तो लूप के अंदर के स्टेटमेंट्स बार-बार एक्सीक्यूट होते हैं। जब कंडीशन फाल्स हो जाती है तब लूप स्वतः समाप्त हो जाता है।
For example, printing numbers from 1 to 100, generating multiplication tables, factorial programs, and sum of series programs are common examples of iterative structure.
उदाहरण के लिए 1 से 100 तक संख्या प्रिंट करना, पहाड़ा बनाना, फैक्टोरियल प्रोग्राम तथा श्रेणी योग प्रोग्राम इटरेटिव स्ट्रक्चर के सामान्य उदाहरण हैं।
Iterative structure reduces code length, saves development time, and improves program efficiency.
इटरेटिव स्ट्रक्चर कोड की लंबाई कम करता है, विकास समय बचाता है तथा प्रोग्राम की कार्यक्षमता को बेहतर बनाता है।
Next Topic: Problem Solving Phases in Programming प्रोग्रामिंग में समस्या समाधान के चरण
No comments:
Post a Comment