Sublime Text does not work properly

Asked

Viewed 67 times

-1

I installed Sublime Text on my linux. I opened the test.cpp file that contains the following code:

#include <iostream>

using namespace std;

int main() {

    cout << "Hello World!" << endl;
    system("pause");

    return 0;
}

But when I run the code only appears: [Finished in 0.9s]

Hello world does not appear, and when I put some reading command neither. I thought he wasn’t running my code, but he only has it open in the sublime, I can’t check.

1 answer

2

The problem is not with the sublime text but with the system("pause");in the linux environment.

Replace with:

std::cout << "Press enter to continue ...";
std::cin.get(); 
  • So, I replace what Voce said, but even so gives no same. I left only Cout and also continues

  • But you need to let the cin.get(); to wait for you to type something before closing.

  • I formulated wrong. I meant I replace what you asked for : std::cout << "Press enter to continue ...";&#xA;std::cin.get(); and I also tried to leave alone cout << "Hello World!" << endl; and yet it continues. I think it’s the compiler, but I downloaded the right gcc.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.