Code::Blocks Forums

User forums => Help => Topic started by: DanielQuevedo on January 26, 2023, 06:13:21 pm

Title: Codebroks closes after pasting content
Post by: DanielQuevedo on January 26, 2023, 06:13:21 pm
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;
}


Title: Re: Codebroks closes after pasting content
Post by: Miguel Gimenez on January 26, 2023, 06:31:25 pm
What is closed, the IDE or the console?.

Please, next time use code tags (the # above the compositing window) to insert code.
Title: Re: Codebroks closes after pasting content
Post by: DanielQuevedo on January 27, 2023, 12:30:54 pm
Hello!

The console closes!
Title: Re: Codebroks closes after pasting content
Post by: Miguel Gimenez on January 27, 2023, 01:24:39 pm
Go to Project -> Properties -> Targets tab, select your target in the left box and check "Pause when execution ends".