Home Download Buy Blog Forum Support

C++

C++

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.

Cheers

#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]
boarder916
 
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.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am


Return to General Discussion

Who is online

Users browsing this forum: bphunter1972, Exabot [Bot], Google [Bot], mstiegl and 11 guests