I need to translate the word no matter if there's a space I need to get the whole line translated. Translating is not the problem but to get whole line is the problem. Can somebody help me fix this?
It is inside the switch statements.
1 2 3 4 5 6 7
string word;
system("cls");
cout << "Please enter a word for Ubi Dubbi translating "<< endl;
cout << "You input :";
getline(cin,word); // here where it doesn't allow me to enter anything and for your input doesn't display also.
cout<<"your translated word is : "<<add_prefix( word, vowels, prefix );
break;
#include <iostream>
#include <string>
int main()
{
while(1)
{
std::string word;
std::cout << "Please enter a word for Ubi Dubbi translating ";
std::getline( std::cin,word);
std::cout<<"your translated word is : "<< word << '\n';
}
return 0;
}
Please enter a word for Ubi Dubbi translating ffffa s
your translated word is : ffffa s
Please enter a word for Ubi Dubbi translating hjjhkj ihjnklnj,klm
your translated word is : hjjhkj ihjnklnj,klm
Please enter a word for Ubi Dubbi translating hhhhhhh jjjjjj
your translated word is : hhhhhhh jjjjjj
Please enter a word for Ubi Dubbi translating iiiiiiw n ejjje n
your translated word is : iiiiiiw n ejjje n
Please enter a word for Ubi Dubbi translating
As you can see, this works perfectly using the shell here
It's not the end of the world. There are good reasons for doing it if you surf around when/if u have time.
because I am using using namespace std;
see above.
if you dont put std:: in front of stuff then you have a couple of alternatives, one of which is using namespace std; which is the quick and dirty way. Up to you.
no it won't work..it doesn't allow me to enter anything .it just display my menu instead..
My posted program works on the console here as the sample output I posted shows. That's why I posted it. Something else must be going on with your program your snippet is not enough to test on it's own. You can run mine yourself by hitting the gear wheel. :)
Did you put #include <string> with your other #include's?
Yep you definitely need that include and that maybe why he can't get it to run. For some reason the shell here turns a blind eye, but it is a little strange at times. :)