Advertisement
khisby

[Soal5]Earthquake_information_center

Oct 9th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.58 KB | None | 0 0
  1. // Khisby Al Ghofari, 06.2017.1.06852, Kelas B
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     float earthquake;
  9.     string status;
  10.  
  11.     cout << "\n=======================================================\n";
  12.     cout << "Welcome To \n";
  13.     cout << "Application The National Earthquake Information Center\n";
  14.     cout << "=========================================================\n \n";
  15.  
  16.     cout << "Input the value Earthquake (separate with dot) : ";
  17.     cin >> earthquake;
  18.  
  19. //    switch(earthquake){
  20. //    case < 5.0:
  21. //        status = "Little or no damage";
  22. //        break;
  23. //    case >= 5.0 && < 5.5:
  24. //        status = "Some damage";
  25. //        break;
  26. //    case >= 5.5 && < 6.5:
  27. //        status = "Serious damage: walls may crack or fall";
  28. //        break;
  29. //    case >= 6.5 && < 7.5:
  30. //        status = "Disaster: houses or buildings may collapse";
  31. //        break;
  32. //    case >= 7.5:
  33. //        status = "Catastrophe: most buildings destroyed";
  34. //        break;
  35. //    }
  36.  
  37.     if(earthquake < 5.0){
  38.         status = "Little or no damage";
  39.     }else if(earthquake >= 5.0 && earthquake < 5.5){
  40.         status = "Some damage";
  41.     }else if(earthquake >= 5.5 && earthquake < 6.5){
  42.         status = "Serious damage: walls may crack or fall";
  43.     }else if(earthquake >= 6.5 && earthquake < 7.5){
  44.         status = "Disaster: houses or buildings may collapse";
  45.     }else if (earthquake >= 7.5){
  46.         status = "Catastrophe: most buildings destroyed";
  47.     }
  48.  
  49.     cout << "The value of earthquake is " << earthquake << " and status is " << status << "\n\n";
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement