--> is not an operator. It is in fact two separate operators, -- and >.
The conditional's code decrements x, while returning x's original (not decremented) value, and then compares the original value with 0 using the > operator.
To better understand, the statement could be written as follows:
while( (x--) > 0 )
The .* operator is used to dereference pointers to class members.
// Operators in C++
#include<iostream>
using namespace std;
int main(){
int a=10, b=5;
// Arithmetic operators
cout<<"Following are the Arithmetic operators in C++"<<endl;
cout<<"The value of a + b is "<<a+b<<endl;
cout<<"The value of a - b is "<<a-b<<endl;
cout<<"The value of a * b is "<<a*b<<endl;
cout<<"The value of a / b is "<<a/b<<endl;
cout<<"The value of a % b is "<<a%b<<endl;
cout<<"The value of a++ is "<<a++<<endl; // First print (a) and then increment it by 1
cout<<"The value of a-- is "<<a--<<endl; // First print (a+1) and then decrease it by 1
cout<<"The value of ++a is "<<++a<<endl; // Increment (a) by (a+1) and then print
cout<<"The value of --a is "<<--a<<endl; // Decrement (a+1) by (a) and then print
cout<<endl;
// Assignment Operators --> used to assign values to variables
// int a =3, b=9;
// char d='d';
// Comparison operators
// Output of all these comparison operators will be (1) if it is true and (0) if it is false
cout<<"Following are the comparison operators in C++"<<endl;
cout<<"The value of a == b is "<<(a==b)<<endl;
cout<<"The value of a != b is "<<(a!=b)<<endl;
cout<<"The value of a >= b is "<<(a>=b)<<endl;
cout<<"The value of a <= b is "<<(a<=b)<<endl;
cout<<"The value of a > b is "<<(a>b)<<endl;
cout<<"The value of a < b is "<<(a<b)<<endl;
cout<<endl;
// Logical operators
cout<<"Following are the logical operators in C++"<<endl;
cout<<"The value of this logical and operator ((a==b) && (a<b)) is:"<<((a==b) && (a<b))<<endl;
cout<<"The value of this logical or operator ((a==b) || (a<b)) is:"<<((a==b) || (a<b))<<endl;
cout<<"The value of this logical not operator (!(a==b)) is:"<<(!(a==b))<<endl;
return 0;
}
// This code is contributed by Suruchi Kumari
#include <iostream>
int main()
{
int value = (1 > 0 ? 12 : 41);
/*
if 1 > 0 then value is 12, else 41
*/
int val2 = (1 > 0 ? (2 > 4 ? 42 : 45) : 41); // nested
}
int sum1 = 100 + 50; // 150 (100 + 50)
int sum2 = sum1 + 250; // 400 (150 + 250)
int sum3 = sum2 + sum2; // 800 (400 + 400)
Is used to declare a reference to other variables and such.