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()
- {
- int value,water,mercury,copper,silver,gold,water_p,mercury_p,copper_p,silver_p,gold_p;
- string substance;
- cout << "\n==============================================\n";
- cout << "Welcome To \n";
- cout << "Application Boiling Point of Several Substances\n";
- cout << "================================================\n \n";
- cout << "Enter the value of boiling point : ";
- cin >> value;
- water = 100;
- mercury = 357;
- copper = 1187;
- silver = 2193;
- gold = 2660;
- water_p = water*5/100;
- mercury_p = mercury*5/100;
- copper_p = copper*5/100;
- silver_p = silver*5/100;
- gold_p = gold*5/100;
- if(value >= water-water_p && value <= water+water_p){
- substance = "Water";
- }else if(value >= mercury-mercury_p && value <= mercury+mercury_p){
- substance = "Mercury";
- }else if(value >= copper-copper_p && value <= copper+copper_p){
- substance = "Copper";
- }else if(value >= silver-silver_p && value <= silver+silver_p){
- substance = "Silver";
- }else if(value >= gold-gold_p && value <= gold+gold_p){
- substance = "Gold";
- }else{
- cout << "Substance Unknown";
- return 0;
- }
- cout << "The value of boiling point is :" << substance;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement