News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Codebroks closes after pasting content

Started by DanielQuevedo, January 26, 2023, 06:13:21 PM

Previous topic - Next topic

DanielQuevedo

I'm currently programming c++ in codeblocks but I cannot paste content in a string.
When I use the command "cin", the prompt screen appears, but when I paste the content or even right click on the screen, the IDE Closes:

#include <iostream>
#include <string>
using namespace std;
int main()
{

    string frase =
"TransacaoCartaoMODALIDADE-E"
"TransacaoCartaoMODALIDADE-S"
"ObtemLogUltimaTransacao-E"
"ObtemLogUltimaTransacao-S"
"ConfirmaCartao-E"
"ConfirmaCartao-S"
"ConfirmaCartaoMODALIDADE-E"
"ConfirmaCartaoMODALIDADE-S"
"FinalizaTransacao-E"
"FinalizaTransacao-S";

    string word;
    cout << "paste the o log here " <<endl;
    cin >> word;



    bool found = frase.find(word) != string::npos;

    if (found) {
        cout << "Found" << word<<endl;
    }
    else {
        cout << "Not found!" << endl;
    }

    return 0;
}



Miguel Gimenez

What is closed, the IDE or the console?.

Please, next time use code tags (the # above the compositing window) to insert code.

DanielQuevedo


Miguel Gimenez

Go to Project -> Properties -> Targets tab, select your target in the left box and check "Pause when execution ends".