periodic table

hello, I need help here. Here is the code

#include <iostream>
using namespace std;
int main ()
{

char element;
cout << " Please enter a symbol. " << endl;
cin >> element;
switch (element)
{
case 'h':
cout <<" You have entered Hydrogen" << endl;
break;
case 'he':
cout <<" You have entered Helium" << endl;
break;

}


return 0;
}

let's say someone puts in h and Hydrogen comes up, and when someone puts in he, hydrogen also comes up, what am i doing wrong, if someone can help that would be great
closed account (Dy7SLyTq)
char can only hold one letter. might i suggest a map of type map<string, string>
closed account (jyU4izwU)
think you have to put int h=Object
closed account (Dy7SLyTq)
no... char only holds one letter. so if he enters 'he' then it will only accept the h so it will go to case 'h' in the switch. and where did you come up with int h = obj? that has nothing to do with the program
Topic archived. No new replies allowed.