Summary of Arithmetic Operators - C++ Operator

C++ examples for Operator:Arithmetic Operator

Introduction

Operation Operator SymbolType
Addition+ Binary
Subtraction - Binary
Multiplication * Binary
Division/ Binary
Modulus% Binary
Negation- Unary

The following code shows using cout to display the results of arithmetic expressions in the statements of a complete program.

Demo Code

#include <iostream>
using namespace std;
int main()/* w w  w.  ja v a2 s  . co  m*/
{
   cout << "15.0 plus 2.0 equals "       << (15.0 + 2.0) << endl
   << "15.0 minus 2.0 equals "      << (15.0 - 2.0) << endl
   << "15.0 times 2.0 equals "      << (15.0 * 2.0) << endl
   << "15.0 divided by 2.0 equals " << (15.0 / 2.0) << endl;
   return 0;
}

Result


Related Tutorials