Advertisement
amrulHarahap

Program Operator Relasi

Dec 19th, 2019
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. // Program menentukan nilai menggunakan Operator Relasi
  2. // Task No.1 file 066-P03.pptx
  3. // Amrul Mubarak Harahap
  4. // 19T03 - 1901098
  5.  
  6. #include <iostream>
  7. #include <string>
  8. #include <cstring>
  9. using namespace std;
  10.  
  11. int main(){
  12.     int a, b, c, d, e, f, g, h, i;
  13.     string hasil0, hasil1, apa, tanya;
  14.  
  15.     apa = "Apakah ";
  16.     tanya = " ? ";
  17.     cout << "Masukkan nilai a: ";cin >> a;
  18.     cout << "Masukkan nilai b: ";cin >> b;
  19.  
  20.     d = a < b;
  21.     e = a > b;
  22.     f = a != b;
  23.     g = a <= b;
  24.     h = a >= b;
  25.     i = a == b;
  26.  
  27.     system ("cls");
  28.     cout << "OPERATOR RELASI" << endl;
  29.     cout << "==========================================="<< endl;
  30.     cout << apa << a << " < " << b << tanya << d << endl;
  31.     cout << apa << a << " > " << b << tanya << e << endl;
  32.     cout << apa << a << " != " << b << tanya << f << endl;
  33.     cout << apa << a << " <= " << b << tanya << g << endl;
  34.     cout << apa << a << " >= " << b << tanya << h << endl;
  35.     cout << apa << a << " == " << b << tanya << i << endl;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement