How can I get the length of the string if it hasn't even been inputed by that point?
arsenalgunners01
Posts
-
Pig-Latin Translator -
Pig-Latin TranslatorThanks for the advice, but that doesn't solve my problem.
-
Pig-Latin TranslatorI have been working on this for a couple of days. I am having trouble understanding why my program seems to hang after the input is translated. From what I can see the program never leaves the while loop. I must clarify that I still am a newbie so forgive me for my stupidity. Any help will be greatly appreciated. Here is what I have so far: #include #include #include class translate { private: char english[20]; public: translate(); }; int main() { translate sentence; return 0; } translate::translate() { char ans; do { cout<<"Please enter a sentence:\n"; while(cin>>english) { if((english[0] == 'a') || (english[0] == 'a') || (english[0] == 'A') || (english[0] == 'e') || (english[0] == 'E') || (english[0] == 'i') || (english[0] == 'I') || (english[0] == 'o') || (english[0] == 'O') || (english[0] == 'u') || (english[0] == 'U')) { cout<> ans; } while((ans == 'y') || (ans == 'Y')); return; }