print first name

I know this is something real stupid that I am not seeing, but when i run this code it says Please enter your first name (followed by 'enter':/n

why is the /n showing up?

#include "std_lib_facilities.h"

int main()
{
cout<<"Please enter your first name (followed by 'enter'):/n";
string first_name;
cin>>first_name;
cout<<"Hello,"<<first_name<<"!/n";
}
closed account (2LzbRXSz)
You're using the wrong kind of slash.

It should be \n
:)

Because the escape char for a newline is a backslash and n not forward slash;

 
cout<<"Please enter your first name (followed by 'enter'):\n";


anyway, use << endl; instead:

 
cout<<"Please enter your first name (followed by 'enter'):" << endl;
You need to replace /n with \n :

 
cout<<"Please enter your first name (followed by 'enter'):\n";
Thanks for the help everyone. Knew it was something stupid. That \n is a pain for sure. Will have to go to << endl; thats again all
Topic archived. No new replies allowed.