🟢 Foundation · Lesson 09
Operators in C++
Operators in C++
What is Operators in C++?
Operators in C++
Operators are symbols that perform calculations, comparisons, assignment and logical checking. They are used in almost every C++ program.
Operators are symbols that perform calculations, comparisons, assignment and logical checking. They are used in almost every C++ program.
Level
🟢 Beginner – C++ Foundation
🟢 Beginner – C++ Foundation
Example File
operators.cppMain Focus
Concept + syntax + practical C++ program
Concept + syntax + practical C++ program
Why should you learn this?
- It helps you write correct and readable C++ programs.
- It is used repeatedly in school practicals, projects and competitive programming.
- It builds the base for advanced topics such as OOP, STL and data structures.
Important Terms
| Term | Meaning / Use |
|---|---|
| arithmetic | Operators in C++ programming में Arithmetic use होता है। |
| relational | Operators in C++ programming में Relational use होता है। |
| logical | Operators in C++ programming में Logical use होता है। |
| assignment | Operators in C++ programming में Assignment use होता है। |
| increment | Operators in C++ programming में Increment use होता है। |
Syntax / Pattern
C++
Examples: + - * / %, == != > <, && || !, = += -=, ++ --
Example Program
main.cpp
#include <iostream>
using namespace std;
int main() {
int a = 10, b = 3;
cout << "Sum = " << a + b << endl;
cout << "Remainder = " << a % b << endl;
cout << "a > b = " << (a > b);
return 0;
}Expected Output
Sum = 13
Remainder = 1
a > b = 1
Program Explanation
- % gives remainder for integer division.
- Relational expression returns true/false, printed as 1/0.
Exam Tip: In C++ practical answers, write the logic first, then the program, then expected output. For theory, always include one suitable example.
Where will you use it?
- marks calculation
- fee calculation
- pass/fail checks
- menu conditions
Common Mistakes
- Using = instead of == in conditions.
- Using % with floating-point numbers.
- Ignoring operator precedence.
Practice Tasks
- Calculate average of three numbers.
- Check whether a number is even or odd.
Summary
Operators in C++ एक ज़रूरी C++ topic है। परिभाषा सीखें, syntax समझें, example program चलाएं और फिर practice tasks हल करके concept मज़बूत करें।
Operators in C++ क्या है?
Operators in C++
Operators are symbols that perform calculations, comparisons, assignment and logical checking. They are used in almost every C++ program.
Operators are symbols that perform calculations, comparisons, assignment and logical checking. They are used in almost every C++ program.
Level
🟢 Beginner – C++ Foundation
🟢 Beginner – C++ Foundation
Example File
operators.cppमुख्य फोकस
Concept + syntax + practical C++ program
Concept + syntax + practical C++ program
इसे क्यों सीखें?
- यह आपको सही और पढ़ने-योग्य C++ programs लिखने में मदद करता है।
- यह school practicals, projects और competitive programming में बार-बार use होता है।
- यह OOP, STL और data structures जैसे advanced topics की नींव बनाता है।
ज़रूरी Terms
| Term | अर्थ / उपयोग |
|---|---|
| arithmetic | Arithmetic Operators in C++ programming में use होता है। |
| relational | Relational Operators in C++ programming में use होता है। |
| logical | Logical Operators in C++ programming में use होता है। |
| assignment | Assignment Operators in C++ programming में use होता है। |
| increment | Increment Operators in C++ programming में use होता है। |
Syntax / Pattern
C++
Examples: + - * / %, == != > <, && || !, = += -=, ++ --
Example Program
main.cpp
#include <iostream>
using namespace std;
int main() {
int a = 10, b = 3;
cout << "Sum = " << a + b << endl;
cout << "Remainder = " << a % b << endl;
cout << "a > b = " << (a > b);
return 0;
}Expected Output
Sum = 13
Remainder = 1
a > b = 1
Program Explanation
- % gives remainder for integer division.
- Relational expression returns true/false, printed as 1/0.
Exam Tip: In C++ practical answers, write the logic first, then the program, then expected output. For theory, always include one suitable example.
Where will you use it?
- marks calculation
- fee calculation
- pass/fail checks
- menu conditions
आम गलतियाँ (Common Mistakes)
- Using = instead of == in conditions.
- Using % with floating-point numbers.
- Ignoring operator precedence.
अभ्यास (Practice Tasks)
- Calculate average of three numbers.
- Check whether a number is even or odd.
सारांश
Operators in C++ एक ज़रूरी C++ topic है। परिभाषा सीखें, syntax समझें, example program चलाएं और फिर practice tasks हल करके concept मज़बूत करें।
💻 Live Code Editor
Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें.
Agar load na ho to naye tab mein kholें.