// Nama = Ilham Hermawan
// Kelas = 1 C
// Prodi = Teknik Informatika
// Nim = 3201616003
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
main(){
int a,b,c;
a=10;
b=2;
cout<<"\t\tOperator Arimatika \n";
cout<<"\tOperator Binary \n";
c=a*b;
cout<<"Operator Perkalian "<<a<<" * "<<b<<" = "<<c<<"\n";
c=a/b;
cout<<"Operator Pembagian "<<a<<" / "<<b<<" = "<<c<<"\n";
c=a%b;
cout<<"Operator Modulus "<<a<<" % "<<b<<" = "<<c<<"\n";
c=a+b;
cout<<"Operator Penjumlahan "<<a<<" + "<<b<<" = "<<c<<"\n";
c=a-b;
cout<<"Operator Pengurangan "<<a<<" - "<<b<<" = "<<c<<"\n";
cout<<"\tOperator Unary \n";
cout<<"Nilai Variabael a = "<<a<<"\n";
c=+a;
cout<<"Operator Tanda Plus +a = "<<c<<"\n";
c=-a;
cout<<"Operator Tanda Minus -a = "<<c<<"\n";
c=++a;
cout<<"Operator ++a = "<<c<<"\n";
a=10;
c=--a;
cout<<"Operator --a = "<<c<<"\n";
cout<<"\t\tOPERATOR BITWISE (MANIPULASI BIT)\n";
cout<<"\tOperator Bitwise\n";
a=10;
cout<<"Nilai Variabel a = "<<a<<"\n";
c=a << 1;
cout<<"Operator Shift left (pergeseran ke kiri) a << 1 (1 bit) = "<<c<<"\n";
c=a>>1;
cout<<"Operator Shift right (pergeseran ke kanan) a >> 1 (1 bit) = "<<c<<"\n";
cout<<"Operasi bit AND (&) \n";
c=0&0;
cout<<"0 & 0 = "<<c<<"\n";
c=1&0;
cout<<"1 & 0 = "<<c<<"\n";
c=0&1;
cout<<"0 & 1 = "<<c<<"\n";
c=1&1;
cout<<"1 & 1 = "<<c<<"\n";
cout<<"Operasi bit OR (|) \n";
c=0|0;
cout<<"0 | 0 = "<<c<<"\n";
c=1|0;
cout<<"1 | 0 = "<<c<<"\n";
c=0|1;
cout<<"0 | 1 = "<<c<<"\n";
c=1|1;
cout<<"1 | 1 = "<<c<<"\n";
gotoxy(22,19);cout<<"Operasi bit XOR (^) \n";
c=0^0;
gotoxy(22,20);cout<<"0 ^ 0 = "<<c<<"\n";
c=1^0;
gotoxy(22,21);cout<<"1 ^ 0 = "<<c<<"\n";
c=0^1;
gotoxy(22,22);cout<<"0 ^ 1 = "<<c<<"\n";
c=1^1;
gotoxy(22,23);cout<<"1 ^ 1 = "<<c<<"\n";
gotoxy(22,24);cout<<"Operasi bit NOT (~) \n";
c=~0;
gotoxy(22,25);cout<<"~ 0 = "<<c<<"\n";
c=~1;
gotoxy(22,26);cout<<"~ 1 = "<<c<<"\n";
gotoxy(1,29); cout<<"\t\tOPERATOR HUBUNGAN \n";
cout<<"Operator Lebih besar >\n";
c=2>0;
cout<<"2 > 0 = "<<c<<" hasil true 1"<<"\n";
c=0>2;
cout<<"0 > 2 = "<<c<<" hasil False 0"<<"\n";
c=2>2;
cout<<"2 > 2 = "<<c<<" hasil False 0"<<"\n";
gotoxy(30,30);cout<<"Operator Lebih kecil <\n";
c=2<0;
gotoxy(30,31);cout<<"2 < 0 = "<<c<<" hasil true 0"<<"\n";
c=0<2;
gotoxy(30,32);cout<<"0 < 2 = "<<c<<" hasil False 1"<<"\n";
c=2<2;
gotoxy(30,33);cout<<"2 < 2 = "<<c<<" hasil False 0"<<"\n";
gotoxy(1,34);cout<<"Lebih besar sama dengan >=\n";
c=2>=0;
cout<<"2 >= 0 = "<<c<<" hasil true 1"<<"\n";
c=0>=2;
cout<<"0 >= 2 = "<<c<<" hasil False 0"<<"\n";
c=2>=2;
cout<<"2 >= 2 = "<<c<<" hasil true 1"<<"\n";
gotoxy(30,34);cout<<"Operator Lebih kecil sama dengan <= \n";
c=2<=0;
gotoxy(30,35);cout<<"2 <= 0 = "<<c<<" hasil true 0"<<"\n";
c=0<=2;
gotoxy(30,36);cout<<"0 <= 2 = "<<c<<" hasil tre 1"<<"\n";
c=2<=2;
gotoxy(30,37);cout<<"2 <= 2 = "<<c<<" hasil True 1"<<"\n";
cout<<"Operator Sama dengan == \n";
c=2==0;
cout<<"2 == 0 = "<<c<<" hasil False 0"<<"\n";
c=0==2;
cout<<"0 == 2 = "<<c<<" hasil False 0"<<"\n";
c=2==2;
cout<<"2 == 2 = "<<c<<" hasil true 1"<<"\n";
gotoxy(30,38);cout<<"Operator Tidak Sama Dengan != \n";
c=2!=0;
gotoxy(30,39);cout<<"2 != 0 = "<<c<<" hasil true 1"<<"\n";
c=0!=2;
gotoxy(30,40);cout<<"0 != 2 = "<<c<<" hasil true 1"<<"\n";
c=2!=2;
gotoxy(30,41);cout<<"2 != 2 = "<<c<<" hasil false 1"<<"\n";
cout<<"\t\tOperator Logika \n";
cout<<"Operator Logika AND ==\n";
c=0&&0;
cout<<"0 && 0 = "<<c<<"\n";
c=1&&0;
cout<<"1 && 0 = "<<c<<"\n";
c=0&&1;
cout<<"0 && 1 = "<<c<<"\n";
c=1&&1;
cout<<"1 && 1 = "<<c<<"\n";
cout<<"Operator Logika OR ||\n";
c=0||0;
cout<<"0 || 0 = "<<c<<"\n";
c=1||0;
cout<<"1 || 0 = "<<c<<"\n";
c=0||1;
cout<<"0 || 1 = "<<c<<"\n";
c=1||1;
cout<<"1 || 1 = "<<c<<"\n";
cout<<"\t\tOPERATOR GABUNGAN \n";
a=10;b=2;
cout<<"Nilai Variabel a = "<<a<<"\n";
cout<<"Nilai Variabel b = "<<b<<"\n";
c=a+=b;
cout<<"a += b = "<<c<<"\t Atau 10 += 2 = "<<c<<"\n";
a=10;b=2;
c=a-=b;
cout<<"a -= b = "<<c<<"\t Atau 10 -= 2 = "<<c<<"\n";
a=10;b=2;
c=a*=b;
cout<<"a *= b = "<<c<<"\t Atau 10 *= 2 = "<<c<<"\n";
a=10;b=2;
c=a/=b;
cout<<"a /= b = "<<c<<"\t Atau 10 /= 2 = "<<c<<"\n";
a=10;b=2;
c=a<<=b;
cout<<"a <<= b = "<<c<<"\t Atau 10 <<= 2 = "<<c<<"\n";
a=10;b=2;
c=a>>=b;
cout<<"a >>= b = "<<c<<"\t Atau 10 >>= 2 = "<<c<<"\n";
a=10;b=2;
c=a&=b;
cout<<"a &= b = "<<c<<"\t Atau 10 &= 2 = "<<c<<"\n";
a=10;b=2;
c=a|=b;
cout<<"a |= b = "<<c<<"\t Atau 10 |= 2 = "<<c<<"\n";
a=10;b=2;
c=a^=b;
cout<<"a ^= b = "<<c<<"\t Atau 10 ^= 2 = "<<c<<"\n";
getch();
}
// Kelas = 1 C
// Prodi = Teknik Informatika
// Nim = 3201616003
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
main(){
int a,b,c;
a=10;
b=2;
cout<<"\t\tOperator Arimatika \n";
cout<<"\tOperator Binary \n";
c=a*b;
cout<<"Operator Perkalian "<<a<<" * "<<b<<" = "<<c<<"\n";
c=a/b;
cout<<"Operator Pembagian "<<a<<" / "<<b<<" = "<<c<<"\n";
c=a%b;
cout<<"Operator Modulus "<<a<<" % "<<b<<" = "<<c<<"\n";
c=a+b;
cout<<"Operator Penjumlahan "<<a<<" + "<<b<<" = "<<c<<"\n";
c=a-b;
cout<<"Operator Pengurangan "<<a<<" - "<<b<<" = "<<c<<"\n";
cout<<"\tOperator Unary \n";
cout<<"Nilai Variabael a = "<<a<<"\n";
c=+a;
cout<<"Operator Tanda Plus +a = "<<c<<"\n";
c=-a;
cout<<"Operator Tanda Minus -a = "<<c<<"\n";
c=++a;
cout<<"Operator ++a = "<<c<<"\n";
a=10;
c=--a;
cout<<"Operator --a = "<<c<<"\n";
cout<<"\t\tOPERATOR BITWISE (MANIPULASI BIT)\n";
cout<<"\tOperator Bitwise\n";
a=10;
cout<<"Nilai Variabel a = "<<a<<"\n";
c=a << 1;
cout<<"Operator Shift left (pergeseran ke kiri) a << 1 (1 bit) = "<<c<<"\n";
c=a>>1;
cout<<"Operator Shift right (pergeseran ke kanan) a >> 1 (1 bit) = "<<c<<"\n";
cout<<"Operasi bit AND (&) \n";
c=0&0;
cout<<"0 & 0 = "<<c<<"\n";
c=1&0;
cout<<"1 & 0 = "<<c<<"\n";
c=0&1;
cout<<"0 & 1 = "<<c<<"\n";
c=1&1;
cout<<"1 & 1 = "<<c<<"\n";
cout<<"Operasi bit OR (|) \n";
c=0|0;
cout<<"0 | 0 = "<<c<<"\n";
c=1|0;
cout<<"1 | 0 = "<<c<<"\n";
c=0|1;
cout<<"0 | 1 = "<<c<<"\n";
c=1|1;
cout<<"1 | 1 = "<<c<<"\n";
gotoxy(22,19);cout<<"Operasi bit XOR (^) \n";
c=0^0;
gotoxy(22,20);cout<<"0 ^ 0 = "<<c<<"\n";
c=1^0;
gotoxy(22,21);cout<<"1 ^ 0 = "<<c<<"\n";
c=0^1;
gotoxy(22,22);cout<<"0 ^ 1 = "<<c<<"\n";
c=1^1;
gotoxy(22,23);cout<<"1 ^ 1 = "<<c<<"\n";
gotoxy(22,24);cout<<"Operasi bit NOT (~) \n";
c=~0;
gotoxy(22,25);cout<<"~ 0 = "<<c<<"\n";
c=~1;
gotoxy(22,26);cout<<"~ 1 = "<<c<<"\n";
gotoxy(1,29); cout<<"\t\tOPERATOR HUBUNGAN \n";
cout<<"Operator Lebih besar >\n";
c=2>0;
cout<<"2 > 0 = "<<c<<" hasil true 1"<<"\n";
c=0>2;
cout<<"0 > 2 = "<<c<<" hasil False 0"<<"\n";
c=2>2;
cout<<"2 > 2 = "<<c<<" hasil False 0"<<"\n";
gotoxy(30,30);cout<<"Operator Lebih kecil <\n";
c=2<0;
gotoxy(30,31);cout<<"2 < 0 = "<<c<<" hasil true 0"<<"\n";
c=0<2;
gotoxy(30,32);cout<<"0 < 2 = "<<c<<" hasil False 1"<<"\n";
c=2<2;
gotoxy(30,33);cout<<"2 < 2 = "<<c<<" hasil False 0"<<"\n";
gotoxy(1,34);cout<<"Lebih besar sama dengan >=\n";
c=2>=0;
cout<<"2 >= 0 = "<<c<<" hasil true 1"<<"\n";
c=0>=2;
cout<<"0 >= 2 = "<<c<<" hasil False 0"<<"\n";
c=2>=2;
cout<<"2 >= 2 = "<<c<<" hasil true 1"<<"\n";
gotoxy(30,34);cout<<"Operator Lebih kecil sama dengan <= \n";
c=2<=0;
gotoxy(30,35);cout<<"2 <= 0 = "<<c<<" hasil true 0"<<"\n";
c=0<=2;
gotoxy(30,36);cout<<"0 <= 2 = "<<c<<" hasil tre 1"<<"\n";
c=2<=2;
gotoxy(30,37);cout<<"2 <= 2 = "<<c<<" hasil True 1"<<"\n";
cout<<"Operator Sama dengan == \n";
c=2==0;
cout<<"2 == 0 = "<<c<<" hasil False 0"<<"\n";
c=0==2;
cout<<"0 == 2 = "<<c<<" hasil False 0"<<"\n";
c=2==2;
cout<<"2 == 2 = "<<c<<" hasil true 1"<<"\n";
gotoxy(30,38);cout<<"Operator Tidak Sama Dengan != \n";
c=2!=0;
gotoxy(30,39);cout<<"2 != 0 = "<<c<<" hasil true 1"<<"\n";
c=0!=2;
gotoxy(30,40);cout<<"0 != 2 = "<<c<<" hasil true 1"<<"\n";
c=2!=2;
gotoxy(30,41);cout<<"2 != 2 = "<<c<<" hasil false 1"<<"\n";
cout<<"\t\tOperator Logika \n";
cout<<"Operator Logika AND ==\n";
c=0&&0;
cout<<"0 && 0 = "<<c<<"\n";
c=1&&0;
cout<<"1 && 0 = "<<c<<"\n";
c=0&&1;
cout<<"0 && 1 = "<<c<<"\n";
c=1&&1;
cout<<"1 && 1 = "<<c<<"\n";
cout<<"Operator Logika OR ||\n";
c=0||0;
cout<<"0 || 0 = "<<c<<"\n";
c=1||0;
cout<<"1 || 0 = "<<c<<"\n";
c=0||1;
cout<<"0 || 1 = "<<c<<"\n";
c=1||1;
cout<<"1 || 1 = "<<c<<"\n";
cout<<"\t\tOPERATOR GABUNGAN \n";
a=10;b=2;
cout<<"Nilai Variabel a = "<<a<<"\n";
cout<<"Nilai Variabel b = "<<b<<"\n";
c=a+=b;
cout<<"a += b = "<<c<<"\t Atau 10 += 2 = "<<c<<"\n";
a=10;b=2;
c=a-=b;
cout<<"a -= b = "<<c<<"\t Atau 10 -= 2 = "<<c<<"\n";
a=10;b=2;
c=a*=b;
cout<<"a *= b = "<<c<<"\t Atau 10 *= 2 = "<<c<<"\n";
a=10;b=2;
c=a/=b;
cout<<"a /= b = "<<c<<"\t Atau 10 /= 2 = "<<c<<"\n";
a=10;b=2;
c=a<<=b;
cout<<"a <<= b = "<<c<<"\t Atau 10 <<= 2 = "<<c<<"\n";
a=10;b=2;
c=a>>=b;
cout<<"a >>= b = "<<c<<"\t Atau 10 >>= 2 = "<<c<<"\n";
a=10;b=2;
c=a&=b;
cout<<"a &= b = "<<c<<"\t Atau 10 &= 2 = "<<c<<"\n";
a=10;b=2;
c=a|=b;
cout<<"a |= b = "<<c<<"\t Atau 10 |= 2 = "<<c<<"\n";
a=10;b=2;
c=a^=b;
cout<<"a ^= b = "<<c<<"\t Atau 10 ^= 2 = "<<c<<"\n";
getch();
}