C++

RMAG news
#include <iostream>

using namespace std;

int main ()
{
int a = 2;
int b = 3;

//Arith op
int c = a + b; // (a – b) or (a * b) or (a / b)
cout << c << endl;

//relat op
if (a == b) // (a != b) or (a > b) or (a <= b)
{
cout << “true stmt” << endl;
}
else
{
cout << “false stmt” << endl;
}

//logic op (0 means false, 1 means true)
int x = 0;
int y = 1;

if (x && y) // (x || y) or !(x) or !(x && y) or !(x || y)
{
cout << “true stmt” << endl;
}
else
{
cout << “false stmt” << endl;
}

//assign op
int d =+ a; // d =- a or d =* a
cout << d << endl;

//Misc op
cout << sizeof(a) << endl;
(a == b) ? cout << “true statement” << endl : cout << “false statement” << endl;
}

Leave a Reply

Your email address will not be published. Required fields are marked *