Sublime Forum

C++

#1

Hello, I am just beginning to learn C++ and I am having issues running a program. It will not let me enter the name I ask for, in other words it won’t let me interact with it. Ill post my code below. Anything helps.

Cheers

#include
#include

int main()
{
// ask for persons name
std::cout << "Please enter your first name: ";

// read the name
std::string name; // define name
std::cin >> name; // read into name

// write a greeting
std::cout << "Hello, " << name << "!" << std::endl;
return 0;

}

It will only print this…

Please enter your first name: Hello, !
[Finished in 0.2s]

0 Likes

#2

There is no interactive input in ST2. You’ll have to run the program from the terminal.

0 Likes