How to stop a for loop that stores strings values entered in C ++?

1

So I've tried everything I tried to compare type typed a "." or set a threshold value and even then the program does not continue, it stays within 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? Has anyone ever had the same problem?

    
asked by anonymous 20.01.2017 / 16:51

1 answer

0

Your code in link has a line like this

for (int y = 0; y < med.size(); x++) {

This line repeats itself indefinitely. Correction obvious:

for (int y = 0; y < med.size(); y++) {
    
21.01.2017 / 00:24