i am trying to make a program that when someone types their name it says something like "your name is..." and i have something like this cout<<"your name is... " <<name; but it only shows the first letter that i typed. how do i show the whole name?
Printable View
i am trying to make a program that when someone types their name it says something like "your name is..." and i have something like this cout<<"your name is... " <<name; but it only shows the first letter that i typed. how do i show the whole name?
Code:int main()
{
using namespace std;
string name;
cout << "What is your name? ";
cin >> name;
cout << "Hello " << name << endl;
return 0;
}
thanks!
ok i copied and pasted it in my thing and i get an error what do i do now? sorry i'm a newbie ; )
Code:#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "What is your name? ";
cin >> name;
cout << "Hello " << name << endl;
return 0;
}
ok thanks