0

How we write a program for displaying a character that can be set by any character.

if we type a show:-a=apple that can be set in program

1st Sep 2018, 2:07 AM
Ankit Kumar
Ankit Kumar - avatar
1 Odpowiedź
+ 2
Make a dictionary using std::map, and just print the specific element that is a match: std::map<char,std::string> dict= { {'a',"Apple"}, {'b',"Box"}, {'c',"Change"}, {'d',"Drink"}, {'e',"Energy"} }; //Add more entries yourself char c; cout<<"Enter Char : "; cout<<c<<"="<<dict[std::tolower(c)]<<endl;
1st Sep 2018, 3:34 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar