# include & ltiostream & gt
Use namespace std
Enumeration sets {a, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, z };;
void char2enum(char ch,set & ampem){
//Implement character-to-enumeration, where the parameter em is the reference type of set, thus passing the result of ch conversion.
char start = ' a
em =(set)((int)ch-(int)start);
}
void main()
{
Character string;
Set the temperature;
Cout & lt& lt Please enter a character: ";
CIN & gt; & gtstr// Get the input characters from the screen.
char2enum(str,temp); //Convert a string to temp of an enumeration.
Switch(temp) // Output according to enumeration value.
{
Case a:
Cout & lt& lta'<& ltendl breaks;
Case b:
Cout & lt& ltb'<& ltendl breaks;
Case c:
Cout & lt& ltc'<& ltendl breaks;
Case d:
Cout & lt& ltd'<& ltendl breaks;
Case e:
Cout & lt& lte'<& ltendl breaks;
Case f:
Cout & lt& ltf'<& ltendl breaks;
//Case G: ... Add these codes yourself.
//Case H: ...
}
}
Test results:
Please enter a character:
return
A // is the output content.