User forums > Help

Codebroks closes after pasting content

(1/1)

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:
Hello!

The console closes!

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

Navigation

[0] Message Index

Go to full version