/*
Logical Operators
==================
&& ( AND )
===
A B Result
======================
1 1 1
1 0 0
0 1 0
0 0 0
|| ( OR )
===
A B Result
======================
1 1 1
1 0 1
0 1 1
0 0 0
! ( NOT )
===
A Result
===============
1 0
0 1
*/
#include<iostream.h>
#include<conio.h>
main()
{
int a=10,b=5;
clrscr();
cout<<"\n a>15 && a<5 :"<<(a>15&&a<5);
cout<<"\n a>5 && a<5 :"<<(a>5&&a<5);
cout<<"\n a>15 && a<15 :"<<(a>15&&a<15);
cout<<"\n a>5 && a<15 :"<<(a>5&&a<15);
cout<<"\n a>15 || a<5 :"<<(a>15||a<5);
cout<<"\n a>5 || a<5 :"<<(a>5||a<5);
cout<<"\n a>15 || a<15 :"<<(a>15||a<15);
cout<<"\n a>5 || a<15 :"<<(a>5||a<15);
cout<<"\n !(a>b) :"<<!(a>b);
cout<<"\n !(a<b) :"<<!(a<b);
getch();
}
Logical Operators
==================
&& ( AND )
===
A B Result
======================
1 1 1
1 0 0
0 1 0
0 0 0
|| ( OR )
===
A B Result
======================
1 1 1
1 0 1
0 1 1
0 0 0
! ( NOT )
===
A Result
===============
1 0
0 1
*/
#include<iostream.h>
#include<conio.h>
main()
{
int a=10,b=5;
clrscr();
cout<<"\n a>15 && a<5 :"<<(a>15&&a<5);
cout<<"\n a>5 && a<5 :"<<(a>5&&a<5);
cout<<"\n a>15 && a<15 :"<<(a>15&&a<15);
cout<<"\n a>5 && a<15 :"<<(a>5&&a<15);
cout<<"\n a>15 || a<5 :"<<(a>15||a<5);
cout<<"\n a>5 || a<5 :"<<(a>5||a<5);
cout<<"\n a>15 || a<15 :"<<(a>15||a<15);
cout<<"\n a>5 || a<15 :"<<(a>5||a<15);
cout<<"\n !(a>b) :"<<!(a>b);
cout<<"\n !(a<b) :"<<!(a<b);
getch();
}
No comments:
Post a Comment