The addition operator is used to add two operands. It is a binary operator and is represented by the symbol '+'.
The subtraction operator is used to subtract the right operand from the left operand. It is represented by the symbol '-'.
This operator multiplies two operands. It is represented by the symbol '*'.
The division operator divides the left operand by the right operand. It is represented by the symbol '/'.
The modulus operator returns the remainder of a division operation. It is represented by the symbol '%'.
#include <iostream>
using namespace std;
int main() {
int a = 10, b = 20;
cout << "Addition: " << (a + b) << endl;
cout << "Subtraction: " << (a - b) << endl;
cout << "Multiplication: " << (a * b) << endl;
cout << "Division: " << (b / a) << endl;
cout << "Modulus: " << (b % a) << endl;
return 0;
}
Console Output:
Addition: 30 Subtraction: -10 Multiplication: 200 Division: 2 Modulus: 0
This operator checks whether two operands are equal. It returns true if they are, and false otherwise.
This operator checks whether two operands are not equal. It returns true if they are not equal, and false otherwise.
This operator checks if the left operand is greater than the right operand.
This operator checks if the left operand is less than the right operand.
This operator checks if the left operand is greater than or equal to the right operand.
This operator checks if the left operand is less than or equal to the right operand.
#include <iostream>
using namespace std;
int main() {
int a = 5, b = 10;
cout << "Equal to: " << (a == b) << endl;
cout << "Not Equal to: " << (a != b) << endl;
cout << "Greater than: " << (a > b) << endl;
cout << "Less than: " << (a < b) << endl;
cout << "Greater than or Equal to: " << (a >= b) << endl;
cout << "Less than or Equal to: " << (a <= b) << endl;
return 0;
}
Console Output:
Equal to: 0 Not Equal to: 1 Greater than: 0 Less than: 1 Greater than or Equal to: 0 Less than or Equal to: 1
This operator returns true if both operands are true, otherwise it returns false.
This operator returns true if at least one of the operands is true, otherwise it returns false.
This operator reverses the logical state of its operand. If a condition is true, it becomes false, and vice versa.
#include <iostream>
using namespace std;
int main() {
bool a = true, b = false;
cout << "Logical AND: " << (a && b) << endl;
cout << "Logical OR: " << (a || b) << endl;
cout << "Logical NOT: " << (!a) << endl;
return 0;
}
Console Output:
Logical AND: 0 Logical OR: 1 Logical NOT: 0
This operator assigns the value on the right to the operand on the left.
This operator adds the right operand to the left operand and assigns the result to the left operand.
This operator subtracts the right operand from the left operand and assigns the result to the left operand.
This operator multiplies the right operand with the left operand and assigns the result to the left operand.
This operator divides the left operand by the right operand and assigns the result to the left operand.
#include <iostream>
using namespace std;
int main() {
int a = 10;
a += 5;
cout << "Add and Assign: " << a << endl;
a -= 3;
cout << "Subtract and Assign: " << a << endl;
a *= 2;
cout << "Multiply and Assign: " << a << endl;
a /= 4;
cout << "Divide and Assign: " << a << endl;
return 0;
}
Console Output:
Add and Assign: 15 Subtract and Assign: 12 Multiply and Assign: 24 Divide and Assign: 6
This operator increases the value of its operand by 1. It can be used as a prefix or postfix.
This operator decreases the value of its operand by 1. It can also be used as a prefix or postfix.
#include <iostream>
using namespace std;
int main() {
int a = 10;
cout << "Initial: " << a << endl;
cout << "Post-increment: " << a++ << endl;
cout << "After Post-increment: " << a << endl;
cout << "Pre-decrement: " << --a << endl;
return 0;
}
Console Output:
Initial: 10 Post-increment: 10 After Post-increment: 11 Pre-decrement: 10
This operator performs a bitwise AND operation on two operands.
This operator performs a bitwise OR operation on two operands.
This operator performs a bitwise XOR operation on two operands.
This operator inverts all the bits of its operand.
This operator shifts the bits of the left operand to the left by the number of positions specified by the right operand.
This operator shifts the bits of the left operand to the right by the number of positions specified by the right operand.
#include <iostream>
using namespace std;
int main() {
int a = 5, b = 9;
cout << "Bitwise AND: " << (a & b) << endl;
cout << "Bitwise OR: " << (a | b) << endl;
cout << "Bitwise XOR: " << (a ^ b) << endl;
cout << "Bitwise NOT: " << (~a) << endl;
cout << "Left Shift: " << (a << 1) << endl;
cout << "Right Shift: " << (b >> 1) << endl;
return 0;
}
Console Output:
Bitwise AND: 1 Bitwise OR: 13 Bitwise XOR: 12 Bitwise NOT: -6 Left Shift: 10 Right Shift: 4
This operator is used to evaluate a condition and return one of two values depending on whether the condition is true or false. It is a shorthand for the if-else statement.
#include <iostream>
using namespace std;
int main() {
int a = 10, b = 20;
int max = (a > b) ? a : b;
cout << "Maximum: " << max << endl;
return 0;
}
Console Output:
Maximum: 20
The comma operator is used to separate two or more expressions. The expressions are evaluated from left to right, and the value of the last expression is returned.
#include <iostream>
using namespace std;
int main() {
int a, b;
a = (b = 3, b + 2);
cout << "Value of a: " << a << endl;
return 0;
}
Console Output:
Value of a: 5
The sizeof operator is used to get the size, in bytes, of a data type or a variable. It helps in determining how much memory a variable occupies.
#include <iostream>
using namespace std;
int main() {
int a;
cout << "Size of int: " << sizeof(a) << " bytes" << endl;
cout << "Size of double: " << sizeof(double) << " bytes" << endl;
return 0;
}
Console Output:
Size of int: 4 bytes Size of double: 8 bytes
Newsletter
Subscribe to our newsletter for weekly updates and promotions.
Wiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterCompany
About usCareersPressCompany
About usCareersPressCompany
About usCareersPressLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesCompany
About usCareersPressCompany
About usCareersPressCompany
About usCareersPressLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesAds Policies