Advertisement
Qlynx

MENENTUKAN HARI ESOK MENGGUNAKAN PROSEDUR FUNGSI

Oct 29th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. string esokhari(string h){
  5.     string hari;
  6.     if (h=="Ahad"){
  7.         hari="Senin";
  8.     }
  9.     else if(h=="Senin"){
  10.         hari="Selasa";
  11.     }
  12.     else if(h=="Selasa"){
  13.         hari="Rabu";
  14.     }
  15.     else if(h=="Rabu"){
  16.         hari="Kamis";
  17.     }
  18.     else if(h=="Kamis"){
  19.         hari="Jumat";
  20.     }
  21.     else if(h=="Jumat"){
  22.         hari="Sabtu";
  23.     }
  24.     else if(h=="Sabtu"){
  25.         hari="Ahad";
  26.     }
  27.     return hari;
  28. }
  29.  
  30.  
  31. int main() {
  32.    
  33.     string day,besok;
  34.     cout << "===================================" << endl;
  35.     cout << "= BUAT BELAJAR, BUKAN BUAT MAINAN =" << endl;
  36.     cout << "===================================" << endl;
  37.    
  38.     cout << "Input Text : "; cin >> day;
  39.     besok = esokhari(day);
  40.     cout << "Hasil\t\t : " << besok <<endl;
  41.    
  42.     return 0;  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement