problem, simple program

I am having a problem. I want this program to ask for your name and then repeat it, with a question mark at the end lol. I know i am a huge noob but i just started, and I am young :p. Thank you very much in advance for all the help. here is the code, I will star the problem. It says: expected unqualified-id


1
2
3
4
5
6
7
8
9
10
#include <iostream>
using namespace std;
int main();
string name;
{
    cout<<"why hello, what is your name, kind sire?";
    cin>> name;
    cout<< name<<"!";
    cout<< "that is a cool name,"<< name
}
Age hardly has anything to do with it.

1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <string>
using namespace std;
int main() {
    string name;
    cout<<"why hello, what is your name, kind sire?";
    cin>> name;
    cout<< name<<"!";
    cout<< "that is a cool name, "<< name << '?';
}

Who taught you to code like this? int main();
Last edited on
omg thank you so much. I Have learned through a book and through internet. I really appreciate your help dude you are awesome :). I am sorry, I make a lot of errors. Also, do I always have to include the #include <string>? How do I know which #include preprocessors to do? I am super new. Sorry for the newby-ness. Once again, thank you!!!
Topic archived. No new replies allowed.