+ 2
Can we give a value range such as 0<x<50?
can we write like if(0<x<50) cout<<"pass";
2 Antworten
+ 4
You can avoid using nested if's, if you use a composite boolean expression:
if (x>0 && x<50) cout<<"pass";
0
No this is incorrect in c++ And allowed in python
In c++ if you want to give a value range you have to use nested 'if '....
if (x >0)
{
if (x <50)
cout << x << "is between 0 and 50 ";
}