โปรแกรมที่ 1
#include iostream.h
#include conio.h
void main()
{
clrscr();
cout<<" Narubes Pitak \n"; cout<<" No.13 \n"; cout<<"--------------------------\n"; cout<<"Display Logic Operation:\a"; cout<<"\nLogic value of expression (3==5) :"<<(3==5); cout<<"\nLogic value of expression (5==5) :"<<(5==5); cout<<"\nLogic value of expression (3<=5) :"<<(3<=5); cout<<"\nLogic value of expression (3>=5) :"<<(3>=5);
cout<<"\nLogic value of expression (3<=5)&&(5>3) :"<<(3<=5)&&(5>3);
cout<<"\nLogic value of expression (3<=5)&&(3>5) :"<<(3<=5)&&(3>5);
cout<<"\nLogic value of expression (3<=5)(3>5) :"<<(3<=5)(3>5);
cout<<"\nLogic value of expression (8<=5)(3>=5):"<<(8<=5)(3>=5);
cout<<"\n\nValue 1 is true, 0 is false...press any key";
getch();
}
โปรแกรมที่ 2
#include
#include
int A=20,B=30,C=2,D=5,E=50;
void main()
{
clrscr();
cout<<" Narubes Pitak \n";
cout<<" No.13 \n";
cout<<"--------------------------\n";
cout<<"\n3.1 ((A>=B)&&(A==A)) ="<<((A>=B)&&(A==A));
cout<<"\n3.2 ((B+C>A+D)((B+CA+D)="((B+C>A+D)((B+BA+D);
cout<<"\n3.3 ((A==20)&&(B>=30)) ="<<((A==20)&&(B>=30));
cout<<"\n3.4 ((50==E)(!D<=E)) ="<<((50==E)(!D<=E));
cout<<"\n3.5 !(D!=5) ="<<(D!=5) ;
cout<<"\n3.6 ((B=C+20)!=50) ="<<((B=C+20)!=50);
cout<<"\n3.7 (C==(D-3)) ="<<(C==(D-3));
cout<<"\n3.8 ((A/C<=B)&&((C+D<=A)(D>A))) ="<<((A/C<=B)&&((C+D<=A)(D>A))); cout<<"\n3.9 ((A%C+5)==(E/5-10)) ="<<((A%C+5)==(E/5-10));
getch();
}