본문 바로가기

Computer General/C++ development from the beginning

Logical OR operator

OR : one of those options is true, then the whole statement is true. (||)

#include <iostream>

#include <cmath>

int main()

{

using namespace std;

cout<<"Do you think.....?<y/n>"<<endl;

char answer;

cin>>answer;

if (answer=='y' || answer=='Y')

cout<<"you fn perv"<<endl;

else if (answer=='n' || answer=='N')

cout<<"ok you're fine"<<endl;

else

cout<<"answer the question right"<<endl;

system("pause");

return 0;
}

'Computer General > C++ development from the beginning' 카테고리의 다른 글

Structures  (0) 2014.12.16
Switch statement  (0) 2014.12.16
The if Statement  (0) 2014.12.12
Address Operator & Pointer  (0) 2014.12.12
Beginning Loop  (0) 2014.12.12