Demonstrates built-in arithmetic operators : Operators « Operators statements « C++ Tutorial






#include <iostream>
using namespace std;

int main()
{
      cout << "7 + 3 = " << 7 + 3 << endl;
      cout << "7 - 3 = " << 7 - 3 << endl;
      cout << "7 * 3 = " << 7 * 3 << endl;

      cout << "7 / 3 = " << 7 / 3 << endl;
      cout << "7.0 / 3.0 = " << 7.0 / 3.0 << endl;

      cout << "7 % 3 = " << 7 % 3 << endl;

      cout << "7 + 3 * 5 = " << 7 + 3 * 5 << endl;
      cout << "(7 + 3) * 5 = " << (7 + 3) * 5 << endl;

      return 0;
}








3.1.Operators
3.1.1.Precedence of C Operators
3.1.2.Demonstrating operators .* and ->*.
3.1.3.Using the unary scope resolution operator
3.1.4.Demonstrates built-in arithmetic operators
3.1.5.Using the & and * operators