Tugas 6.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <string.h> using namespace std; //NAMA : Ramdika Rovansah //NIM : 3420230027 //TUGAS : 6.1 int main() { char kodeKaryawan; string nama; string posisi; int gaji; cout << "========================================\n"; cout << "Kode | Posisi | Gaji\n"; cout << "----------------------------------------\n"; cout << " A | QA Engineer | 6.000.000\n"; cout << " B | FE Engineer | 7.000.000\n"; cout << " C | BE Engineer | 8.000.000\n"; cout << "========================================\n"; cout << " Data Karyawan PT ABC \n"; cout << "========================================\n"; cout << "Masukkan Nama Anda\t: "; cin >> nama; cout << "\nKode Karyawan [A/B/C]\t: "; cin >> kodeKaryawan; cout << "\nKode Yang Dipilih\t: " << kodeKaryawan << endl; cout << "----------------------------------------\n"; cout << " Hasil Switch Case"; cout << "\n----------------------------------------\n"; switch (kodeKaryawan) { case 'A': case 'a': posisi = "QA Engineer"; gaji = 6000000; break; case 'B': case 'b': posisi = "FE Engineer"; gaji = 7000000; break; case 'C': case 'c': posisi = "BE Engineer"; gaji = 8000000; break; default: cout << "Kode karyawan tidak valid.\n"; return 0; } cout << "Halo selamat datang " << nama << ".\n"; cout << "Kode yang kamu pilih adalah " << kodeKaryawan << ".\n"; cout << "Untuk kode " << kodeKaryawan << " maka posisi kamu adalah " << posisi << ".\n"; cout << "Dengan posisi " << posisi << " maka gaji kamu adalah " << gaji << " per bulan.\n"; cout << "========================================\n"; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines