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
#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;
}
Comments
Leave a comment