SHARE
TWEET

fpcnd

a guest Jun 11th, 2019 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.     char pilihan, q;
  6.     string username, password;
  7.  
  8.     cout << "=== Welcome ===" << endl;
  9.     cout << "Username: ";
  10.     cin >> username;
  11.     cout << "Password: ";
  12.     cin >> password;
  13.  
  14.     if (username == "admin"){
  15.         if (password == "final"){
  16.             cout << "Selamat datang!" << endl;
  17.         } else {
  18.             cout << "Password salah, coba lagi!" << endl;
  19.         }
  20.     } else {
  21.         cout << "Anda tidak terdaftar" << endl;
  22.     }
  23.  
  24. menu:
  25.     cout << "1. ip" << endl;
  26.     cout << "2. test" << endl;
  27.     cin >> pilihan;
  28.    
  29.     finish:
  30.     cout << "selesai" << endl;
  31. switch(pilihan){
  32. case '1':
  33.             int a[4], i;
  34.  
  35.         cout<<"Masukkan IP address: ";
  36.         for(i=0;i<4;i++)
  37.                 cin>>a[i];
  38.  
  39.         cout<<"\n IP Address:"<<a[0];
  40.         cout<<"."<<a[1]<<"."<<a[2]<<"."<<a[3]<<"\n";
  41.  
  42.         cout<<"Ini Termasuk IP Address: ";
  43.  
  44.         if(a[0]>=0 && a[0]<=127)
  45.         cout << "Class A" << endl;
  46.         if(a[0]>127 && a[0]<191)
  47.         cout << "Class B" << endl;
  48.         if(a[0]>191 && a[0]<224)
  49.         cout << "Class C";
  50.         if(a[0]>224 && a[0]<=239)
  51.         cout  <<"Class D" << endl;
  52.         if(a[0]>239)
  53.         cout << "Class E" << endl;
  54.        
  55.     std::cout << "Apakah anda Ingin lagi? [Y/N]";
  56.     std::cin >> q;  
  57.    
  58.     if(q == 'Y' || q == 'y')
  59.     {
  60.         goto menu;
  61.     }else if ( q == 'N' || q == 'n'){
  62.         goto finish;
  63.     }else {
  64.         goto finish;
  65.     }
  66.      cin.get();
  67.      break;  
  68.  
  69. case '2':
  70.        
  71.         cout << "test" << endl;
  72.  
  73.     std::cout << "Apakah anda Ingin lagi? [Y/N]";
  74.     std::cin >> q;  
  75.    
  76.     if(q == 'Y' || q == 'y')
  77.     {
  78.         goto menu;
  79.     }else if ( q == 'N' || q == 'n'){
  80.         goto finish;
  81.     }
  82.      cin.get();
  83.      break;
  84.  
  85.     }
  86.  
  87. return 0;
  88. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top