#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
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