Home Download Buy Blog Forum Support



Postby boarder916 on Thu Nov 29, 2012 11:36 pm

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.


#include <iostream>
#include <string>

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]
Posts: 1
Joined: Thu Nov 29, 2012 11:33 pm

Re: C++

Postby C0D312 on Fri Nov 30, 2012 12:12 am

There is no interactive input in ST2. You'll have to run the program from the terminal.
Posts: 1056
Joined: Sun Jul 10, 2011 3:23 am

Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], hnhjjjjhjh, wbdor and 20 guests