mercredi 3 octobre 2018

Enhanced if statement with two (different) variable comparison operators

I wanted to make a simple enhanced if statement (that is the correct definition right?) when a == 1 OR b > 2 it prints out how to say how are you sir in Arabic.

Is it possible to compare two different variables in an if and else if statement? I got myself in a Chinese finger trap with all the ('s and )'s and the different types of logical operators.

Here is my c++ code:

#include <iostream>

using namespace std;

//If / Else statement is basically a enhanced if statement.

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

if ((a==1)||(b>2)){
    cout << "Kevak chala komm?" << endl;
}

if (((else)) (a == 1) && (b == 2)))) {
    cout << "Louis C.K. is back my brothers!" << endl;
}
else{
cout << "Jek shi mash? " << endl; // How are you in polish.
}
return 0;
}

Aucun commentaire:

Enregistrer un commentaire