🟢 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
arithmeticArithmetic used in Operators in C++ programming.
relationalRelational used in Operators in C++ programming.
logicalLogical used in Operators in C++ programming.
assignmentAssignment used in Operators in C++ programming.
incrementIncrement used in Operators in C++ programming.

Syntax / Pattern

Examples: + - * / %, == != > <, && || !, = += -=, ++ --

Example Program

#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++ is an important C++ topic. Learn the definition, understand the syntax, run the example program and then solve the practice tasks to make the concept strong.

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
arithmeticArithmetic used in Operators in C++ programming.
relationalRelational used in Operators in C++ programming.
logicalLogical used in Operators in C++ programming.
assignmentAssignment used in Operators in C++ programming.
incrementIncrement used in Operators in C++ programming.

Syntax / Pattern

Examples: + - * / %, == != > <, && || !, = += -=, ++ --

Example Program

#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++ is an important C++ topic. Learn the definition, understand the syntax, run the example program and then solve the practice tasks to make the concept strong.

← Back to C++ Tutorial