Kamis, 21 April 2011

TUGAS 2

/* Penggunaan Operasi Logika AND/OR */

#include <iostream.h>
#include <conio.h>
#include <stdio.h>

main()
{
float A, B, C, K, L, M, D, E, F, G, H;
clrscr();
cout<<"\t\t\t* Masukkan Nilai A : ";cin>>A;
cout<<"\t\t\t^ Masukkan Nilai B : ";cin>>B;
cout<<"\t\t\t* Masukkan Nilai C : ";cin>>C;
cout<<"\t\t\t^ Masukkan Nilai K : ";cin>>K;
cout<<"\t\t\t* Masukkan Nilai L : ";cin>>L;
cout<<"\t\t\t^ Masukkan Nilai M : ";cin>>M;

//proses
D = (4+2>A&&B-2>3+2||B+2<=6+2);
E = K+5<M||M<L&&2*M-L>0;
F = L+5<M||C*K<L&&2*K-L>0;
G = A*4<=3*M+B;
H = K+10>A&&L-2>4*C;

cout<<endl;
cout<<"\t\t\t** Program Ekspresi AND/OR **"<<endl;
cout<<"================================================================================"<<endl;
cout<<"\t\tHasil dari D = (4+2>A&&B-2>3+2||B+2<=6+2) adalah : " <<D<<endl;
cout<<"\t\tHasil dari E = K+5<M||M<L&&2*M-L>0 adalah        : " <<E<<endl;
cout<<"\t\tHasil dari F = L+5<M||C*K<L&&2*K-L>0 adalah      : " <<F<<endl;
cout<<"\t\tHasil dari G = A*4<=3*M+B adalah                 : " <<G<<endl;
cout<<"\t\tHasil dari H = K+10>A&&L-2>4*C adalah            : " <<H<<endl;
cout<<endl;
getch();
}
 


Hasil Output

Tidak ada komentar:

Posting Komentar