Answer to Question #171626 in C++ for Karthick Soundar C

Question #171626

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-15T04:12:55-0400
#include <bits/stdc++.h>
using namespace std;




int main() {
    string material;
    
    cout<<"Enter the name of material: ";
    cin>>material;
    
    if (material == "Oxygen")
    {
        cout<<"gas";
    }
    
    else if (material == "Water" || material == "Petrol")
    {
        cout<<"liquid";
    }
    
    else if (material == "Gold" || material == "Ice")
    {
        cout<<"solid";
    }
    
    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