0

I made a programm in C++. It first asks you about your age and then about your name. Why does it automatically print "Hello !" in the console? Please help. Here is the code:

int Age;
cout << "Type in your age: ";

cin >> Age;

cout << "You are " << Age << " years old." << endl;

string name;

cout << "Enter your name: " << endl;

getline(cin, name);

cout << "Hello " << name << endl;

I used Codeblocks to programm this.

I want it to ask your age first and then your name.

Thanks.

Max1962
  • 15
  • 5

0 Answers0