AlgoritmaTugas6.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <string.h> using namespace std; int main() { char kode, posisi[20], nama[20]; int gaji; cout<<"---------------------------------"<<endl; cout<<"Kode | Posisi | Gaji |"<<endl; cout<<"---------------------------------"<<endl; cout<<"A | QA Engineer | 6.000.000 |"<<endl; cout<<"B | FE Engineer | 7.000.000 |"<<endl; cout<<"C | BE Engineer | 8.000.000 |"<<endl; cout<<"---------------------------------"<<endl; cout<<endl; cout<<"---------------------------------"<<endl; cout<<" Data Karyawan PT ABC"<<endl; cout<<"---------------------------------"<<endl; cout<<"Masukan Nama Anda\t: ";cin>>nama; cout<<endl; cout<<"Kode Karyawan [A/B/C]\t: ";cin>>kode; cout<<"\n"; cout<<"Kode Yang Dipilih\t: "<<kode<<endl; switch (kode) { case 'A': case 'a': strcpy(posisi, "QA Engineer"); gaji = 6; break; case 'B': case 'b': strcpy(posisi, "FE Engineer"); gaji = 7; break; case 'C': case 'c': strcpy(posisi, "BE Engineer"); gaji = 8; break; default: strcpy(posisi, "SALAH KODE"); gaji = 0; break; } cout<<'\n'; cout<<"---------------------------------"<<endl; cout<<" Hasil Switch Case"<<endl; cout<<"---------------------------------"<<endl; printf("Halo selamat datang %s.\n", nama); printf("Kode yang kamu pilih adalah %c.\n", kode); printf("Untuk kode %c maka posisi kamu adalah %s.\n", kode, posisi); printf("Dengan posisi %s maka gaji kamu adalah %i juta perbulan.\n", posisi, gaji); cout<<"---------------------------------"<<endl; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines