This is my code that I am struggling to get the results (ICAO words) printed. My code has to use functions, have a user menu, and cant use arrays. Whenever I do not have a user menu or functions then the code runs perfectly. As soon as I add everything else, it does not seem to print the results. Any advice?
string Wrd_Otpt = " ";
// Program will retrieve the appropriate ICAO word to match the character
Letters is an uninitialized variable.
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
char Letters; // local variable; will store one character
cout<< " Enter a word or name: ";
for(int i = 0; i < Word_Input.length(); i++)
Letters = Word_Input.at (i); // each assignment overwrites the Letters
// Letters now has last character of Word_Input
} // Letters is destroyed here
We get no data by calling userInput() because it does not pass anything to us.
Note how you call function string::at(): Letters = Word_Input.at (i);
You pass data, argument 'i' to the function.
You receive data; store the return value of at() into variable 'Letters'.