error when debugging

Can someone tell me what i'm doing wrong with line 11

#include <iostream>
#include <string>
int main(void)
{
using std::cout;
using std::cin;
using std::string;
string name = ""; // "" means empty string
cout << "what is your name?\n" ;
cin >> name;
cout << "\nhello name " << name.c_str() "\n" ;
return 0;
}


1>c:\users\charles\documents\visual studio 2008\projects\hello\hello\hello.cpp(11) : error C2143: syntax error : missing ';' before 'string'
closed account (z05DSL3A)
try changing
cout << "\nhello name " << name.c_str() "\n" ;
to
cout << "\nhello name " << name.c_str() << "\n" ;
or even
cout << "\nhello name " << name << "\n" ;
Last edited on
Thanks that worked
Topic archived. No new replies allowed.