Answer to Question #173226 in C++ for Praveen Kumar b

Question #173226

    The table given below shows the list of gases, liquids and solids. By entering the substances, find the state of the material. Implement the above logic through C++.

S.No.

Materials

      1

Water

      2

Oxygen

      3

Gold

      4

Ice

      5

Petrol

1
Expert's answer
2021-03-19T02:16:24-0400
#include <bits/stdc++.h>
using namespace std;




int main() {
    int material;

    cout<<"Enter the name of material: "<<endl;
    cout<<"For Water: enter 1"<<endl;
    cout<<"For Oxyen: enter 2"<<endl;
    cout<<"For Gold: enter 3"<<endl;
    cout<<"For Ice: enter 4"<<endl;
    cout<<"For Patrol: enter 5"<<endl;

    cin>>material;

    switch(material){
        case 1:
            cout<<"You have selected Water."<<endl;
            cout<<"It is liquid NTP."<<endl;
            break;
        case 2:
            cout<<"You have selected Oxygen."<<endl;
            cout<<"It is gas at NTP."<<endl;
            break;
        case 3:
            cout<<"You have selected Gold."<<endl;
            cout<<"It is Solid at NTP."<<endl;
            break;
        case 4:
            cout<<"You have selected Ice."<<endl;
            cout<<"It is Solid at NTP."<<endl;
            break;
        case 5:
            cout<<"You have selected Patrol."<<endl;
            cout<<"It is liquid at NTP."<<endl;
            break;
        default:
        cout<<"You have choosen incorrect value, please choose correct one"<<endl;
        break;
    }
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS