संदेश

जून, 2025 की पोस्ट दिखाई जा रही हैं

Various Looping Programs in C++

चित्र
  * Program to print table of a given number: Output: * Program to print following series: 3     2     6     4     9     6     12     8     .     .     .     .     .     .     . Output: * Program to print Fibonacci series: 0     1     1     2     3     5     8     13     21     34     .     .     .     .     .     .     . Output: * Program to print following series: 2     6     11     17     24     32     41     51     .     .     .     .     . Output: * Program to find factorial of a given number: Output: * Program to check a given number is Prime or Not: Output: * Pro...

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 कर जाता ह...

Simple Programs of C++

चित्र
Simple Programs * Program to print a message  Output:  * Program to add two given numbers: Output:  *  Program to find Simple Interest: Output: * Program to find Volume of Cylinder: Output:  * Program to input a number of 2 digits and interchange its digits: Output:  * Program to swap two numbers: Output:

Basic Concepts of C++ Program

चित्र
main( ) function  C++ program में main() की सबसे मुख्य भूमिका होती है | C++ programming language के प्रत्येक program में main () function की definition बनाना आवश्यक होता है, क्योकि जैसे ही C++ program को run कराया जाता है, वैसे ही Compiler सर्वप्रथम main () function को call करता है तथा program में main () function की definition को search करता है | अतः प्रत्येक program में main () की definition का होना अनिवार्य है |  Program में perform किये जाने वाले operation को main () function की definition के अंदर ही लिखा जाता है | main () function की definition लिखते समय main () से पहले main () function का return type लिखा जाता है | main () से पहले return type के स्थान पर int लगाया जाता है अर्थात int main () लिखा जाता है, तो इसका अर्थ है कि main ()  function द्वारा एक integer value return की जाएगी |  User Defined Function  main () function के अतिरिक्त भी C++ program में अन्य functions की definition के codes लिखे जाते हैं तथा user के द्वारा define किये गए इन functions को ही ...

Operators in C++

चित्र
Operator  Operator, C++ program में use किये जाने वाले कुछ विशेष चिह्न होते हैं, जिन्हे एक निश्चित arithmetical या logical operation को perform करने के लिए use किया जाता है |  example  c = a + b ; उपरोक्त statement में = और + operators के साथ use किये जाने वाले variables को operands कहा जाता है अर्थात a तथा b, + operator के operands हैं तथा एवं (a + b), = operator के operands हैं |  Operators के साथ use किये जाने वाले operands के आधार पर C++ programming के विभिन्न operators को निम्न भागों में बांटा गया है -  Unary Operator C++ programming में use होने वाले ऐसे operators, जिनके साथ सिर्फ एक operand का use किया जाता है, उन्हें Unary Operator कहा जाता है | जैसे - ++, - - आदि |  Binary Operator  ऐसे operators, जिन्हे use करने के लिए 2 operands की आवश्यकता होती है, उन्हें Binary Operator कहा जाता है | जैसे - +, -, *, /, %, =, <, > आदि |  Ternary Operator  C++  में मात्र एक ही ternary operator होता है | इस operator के साथ 3 operands use ...

Token in C++

चित्र
Token C++ programming में कुछ individual words या character का use किया जाता है , जिनके निश्चित कार्य होते हैं, इन्हे Tokens कहा जाता है |  C++ programming में Tokens को निम्नलिखित भागों में वर्गीकृत किया गया है -  1. Keyword  2. Identifier  3. Literals / Constants  4. Operator  5. Punctuator  1. Keyword  C++ programming में कुछ पूर्व निर्धारित शब्द होते हैं , जिन्हे निश्चित कार्यों के लिए reserve किया गया है | इन्ही words को keyword कहा जाता है | जैसे - int             if              break           for            class  char         else          continue     struct        public  float         switch     do                void    ...