Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Khisby Al Ghofari, 06.2017.1.06852, Kelas B
- #include <iostream>
- using namespace std;
- int main()
- {
- float earthquake;
- string status;
- cout << "\n=======================================================\n";
- cout << "Welcome To \n";
- cout << "Application The National Earthquake Information Center\n";
- cout << "=========================================================\n \n";
- cout << "Input the value Earthquake (separate with dot) : ";
- cin >> earthquake;
- // switch(earthquake){
- // case < 5.0:
- // status = "Little or no damage";
- // break;
- // case >= 5.0 && < 5.5:
- // status = "Some damage";
- // break;
- // case >= 5.5 && < 6.5:
- // status = "Serious damage: walls may crack or fall";
- // break;
- // case >= 6.5 && < 7.5:
- // status = "Disaster: houses or buildings may collapse";
- // break;
- // case >= 7.5:
- // status = "Catastrophe: most buildings destroyed";
- // break;
- // }
- if(earthquake < 5.0){
- status = "Little or no damage";
- }else if(earthquake >= 5.0 && earthquake < 5.5){
- status = "Some damage";
- }else if(earthquake >= 5.5 && earthquake < 6.5){
- status = "Serious damage: walls may crack or fall";
- }else if(earthquake >= 6.5 && earthquake < 7.5){
- status = "Disaster: houses or buildings may collapse";
- }else if (earthquake >= 7.5){
- status = "Catastrophe: most buildings destroyed";
- }
- cout << "The value of earthquake is " << earthquake << " and status is " << status << "\n\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement