TOPIC

Runtime Error

Rafael F. Goto asked 2 years ago

#include <iostream>
using namespace std;

int main (void)
{
    string entry, aux;
    int run;

    cin >> run;
    cin.ignore();

    for (int k = 0; k < run; k++) {
        getline(cin, entry);
        size_t pos = entry.find_first_of(" ");

        aux = entry.substr(pos+1);
        entry = entry.substr(0, pos);

        size_t ppos = entry.length() - aux.length();
        entry = entry.substr(ppos);

        if (entry == aux)
            cout << "encaixa" << endl;
        else
            cout << "nao encaixa" << endl;
    }

    return 0;
}

Alguem tem ideia o porque está dando runtime error, sendo que na minha máquina funciona ?

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.