Author Topic: Codebroks closes after pasting content  (Read 2689 times)

Offline DanielQuevedo

  • Single posting newcomer
  • *
  • Posts: 2
Codebroks closes after pasting content
« 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;
}



Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1632
Re: Codebroks closes after pasting content
« Reply #1 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.

Offline DanielQuevedo

  • Single posting newcomer
  • *
  • Posts: 2
Re: Codebroks closes after pasting content
« Reply #2 on: January 27, 2023, 12:30:54 pm »
Hello!

The console closes!

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1632
Re: Codebroks closes after pasting content
« Reply #3 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".