mardi 7 avril 2020

Condition Check in C++ [duplicate]

Out of the two versions (below) of condition check which version is better? and Why?

Version 1:

#include<iostream>
using namespace std;
int main()
{
int x;
cin >> x;
if (x == 1) // version 1
    { cout << "Hello world!" << endl;
  }

return 0 ;
}

Version 2:

#include<iostream>
using namespace std;
int main()
{
int x;
cin >> x;
if (1 == x) // version 2
    { cout << "Hello world!" << endl;
  }

return 0 ;
}

Aucun commentaire:

Enregistrer un commentaire