🟢 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.
Level
🟢 Beginner – C++ Foundation
Example File
operators.cpp
Main Focus
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

TermMeaning / Use
arithmeticOperators in C++ programming में Arithmetic use होता है।
relationalOperators in C++ programming में Relational use होता है।
logicalOperators in C++ programming में Logical use होता है।
assignmentOperators in C++ programming में Assignment use होता है।
incrementOperators 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

  1. Calculate average of three numbers.
  2. 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.
Level
🟢 Beginner – C++ Foundation
Example File
operators.cpp
मुख्य फोकस
Concept + syntax + practical C++ program

इसे क्यों सीखें?

  • यह आपको सही और पढ़ने-योग्य C++ programs लिखने में मदद करता है।
  • यह school practicals, projects और competitive programming में बार-बार use होता है।
  • यह OOP, STL और data structures जैसे advanced topics की नींव बनाता है।

ज़रूरी Terms

Termअर्थ / उपयोग
arithmeticArithmetic Operators in C++ programming में use होता है।
relationalRelational Operators in C++ programming में use होता है।
logicalLogical Operators in C++ programming में use होता है।
assignmentAssignment Operators in C++ programming में use होता है।
incrementIncrement 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)

  1. Calculate average of three numbers.
  2. Check whether a number is even or odd.

सारांश

Operators in C++ एक ज़रूरी C++ topic है। परिभाषा सीखें, syntax समझें, example program चलाएं और फिर practice tasks हल करके concept मज़बूत करें।

← Back to C++ Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

\n

💻 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ें.