How can I use the "cin" code to ask for a letter as an input?
I'm playing with arrays and data types and am trying to create a simple code that will ask to enter a letter between a to e. Each letter chosen will print a certain word in return. I'm not fully getting how to use data types and arrays. Here's my currently dysfunctional code: #include <iostream> using namespace std; int main () { string letter[5]={"minor", "toddler", "child", "teenager", "adult"}; string L[5]; cout << "enter a letter between a to e\n\n"; cin >>L; switch (L) { case a: cout <<letter[0]; break; case b: cout <<letter[1]; break; case c: cout <<letter[2]; break; case d: cout <<letter[3]; break; case e: cout <<letter[4]; break; } return 0; }