PERTEMUAN 3 TASK 2
----------------------------------------------
Membuat Operator Logika dengan Borland C++
-------------------------------------------------------------
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <windows.h>
void setcolor(unsigned short color)
{
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon,color);
}
int main()
{
float a, b, c, d, m;
clrscr();
setcolor(12);
cout<<"=========================="<<endl;
cout<<"*****OPERATOR LOGIKA*****"<<endl;
cout<<"=========================="<<endl;
cout<<"Masukan Nilai M = "; cin>>m;
a= m>=0 && m>=150;
b= m>=0 && m<=150;
c= m>=0 || m<=150;
d= m<=0 || m>=150;
cout<<endl;
cout<<"=========================="<<endl;
cout<<"***** HASIL *****"<<endl;
cout<<"=========================="<<endl;
cout<<"<" <<m <<"> =0 && " <<m << "<=150>-->"<<a<<endl;
cout<<"<" <<m <<"> =0 && " <<m << "<=150>-->"<<b<<endl;
cout<<"<" <<m <<"> =0 || " <<m << "<=150>-->"<<c<<endl;
cout<<"<" <<m <<"> =0 || " <<m << "<=150>-->"<<d<<endl;
cout<<"=========================="<<endl;
getch();
}

Tidak ada komentar:
Posting Komentar