Tentukan apa hasil numerik dari ekspresi relasi dan logika dibawah ini. Diberikan
nilai A = 3; B = 6 ; C = 2 ; K = 5; L = 4; M = 3
a. D = (4 + 2 > A && B – 2 > 3 + 2 || B + 2 <= 6 + 2 )
b. D=K + 5 < M || (C * M < L && 2 * M – L > 0)
c. D=L + 5 < M || C * K < L && 2 * K – L > 0
d. D=A * 4 <= 3 * M + B
e. D=K + 10 > A && L – 2 > 4 * C
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
main()
{
char nama[15], kelas[20], nim[10];
float A, B, C, K, L, M, D, E, F, G, H;
clrscr();
cout<<"\tBIODATA SAYA\n";
cout<<"NIM :" ;cin>>nim;
cout<<"Nama :" ;gets(nama);
cout<<"Kelas :" ;cin>>kelas;
cout<<endl;
cout<<"(^o^)/-----------------------(^o^)/"<<endl;
cout<<endl;
cout<<"\tNilai A =";cin>>A;
cout<<"\tNilai B =";cin>>B;
cout<<"\tNilai C =";cin>>C;
cout<<"\tNilai K =";cin>>K;
cout<<"\tNilai L =";cin>>L;
cout<<"\tNilai M =";cin>>M;
cout<<endl;
cout<<"(^o^)/-----------------------(^o^)/"<<endl;
//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<<"\tprogram ekspresi NOT"<<endl<<endl;
cout<<"hasil dari D = (4+2>A&&B-2>3+2||B+2<=6+2) adalah" <<D<<endl;
cout<<"hasil dari E = K+5<M||M<L&&2*M-L>0 adalah" <<E<<endl;
cout<<"hasil dari F = L+5<M||C*K<L&&2*K-L>0 adalah" <<F<<endl;
cout<<"hasil dari G = A*4<=3*M+B adalah" <<G<<endl;
cout<<"hasil dari H = K+10>A&&L-2>4*C adalah" <<H<<endl;
cout<<endl<<endl;
cout<<"(^o^)/-----------------------(^o^)/"<<endl;
cout<<endl;
getch();
}
0 komentar:
Posting Komentar