Tugas 6.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <string.h> using namespace std; //Nama: Nadzia Dibda //3420230011 int main() { char kode, nama[15], posisi[20]; int gaji; cout<<"-------------------------------------"<<endl; cout<<"| Kode | Posisi | Gaji |"<<endl; cout<<"-------------------------------------"<<endl; cout<<"| A | QA Engineer | Rp.6.000.000 |"<<endl; cout<<"| B | FE Engineer | Rp.7.000.000 |"<<endl; cout<<"| C | BE Engineer | Rp.8.000.000 |"<<endl; cout<<"-------------------------------------"<<endl; cout<<endl; cout<<"-------------------------------------"<<endl; cout<<" Data Karyawan PT ABC" <<endl; cout<<"-------------------------------------"<<endl; cout<<"Masukkan Nama Anda \t: \n", cin>>nama; cout<<"Kode Karyawan [A/B/C] \t: "; cin>>kode; cout<<"\n"; printf("Kode yang dipilih \t: %c\n", kode); switch (kode) { case 'A': strcpy(posisi, "QA Engineer"), gaji = 6; break; case 'B': strcpy(posisi, "FE Engineer"), gaji = 7; break; case 'C': strcpy(posisi, "BE Engineer"), gaji = 8; break; default : strcpy(posisi, "Kode Salah"), gaji = 0; } cout<<"\n-------------------------------------"<<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 %d juta perbulan ", posisi, gaji); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines