2
So I’ve tried everything I’ve tried to compare type typed a "." or set a limit value and even then the program does not continue, it stays inside the infinite loop. The code comes next:
vector<string> inserir(){
vector<string>f;
for(int x = 0;x < 5;x++){
string s;
cin>>s;
f.push_back(s);
}
return f;
}
can anyone help me? Someone who has already had the same problem?
Just to understand his code is stuck in the for(... ? Strange why should he loop 5 times as you set. Check if it is right there that it is locking.
– Wagner Soares
it can only be there because it dps to type 5 words it continues on Cin waiting to type more
– Rhuan Carlos
I realized now that you are using Cin>s; and the program will stop on this line waiting for you to enter some data with the keyboard and wait for Enter to proceed.
– Wagner Soares
I use eclipse, I didn’t rule out the possibility of it being him doing grace
– Rhuan Carlos
tried on another ide gave the same thing...
– Rhuan Carlos
use Std::getline(Std::Cin, s) instead of Cin >> s.
– Michael Pacheco
so when I want to read a string I use getline()?
– Rhuan Carlos
put a complete (small) example...the code you posted doesn’t seem to have errors
– zentrunix
http://cpp.sh/9x2n3 posted c++ shell to facilitate
– Rhuan Carlos