I just started learning c++, and as I'm learning the basics, I noticed that when I asked for two inputs (cin for age and getline() for a name) the program would ask the user for the age (the first input) but then shows all of the cout(s) without asking for the second input (getline()). Is there a c++ concept about inputs and outputs that I'm unaware of? because, as far as I'm aware, my code doesn't seem to have a problem.
here's a snippet of a very simple code:
#include <iostream>
using namespace std;
int main()
{
int age;
cout << "Enter your age: ";
cin >> age;
cout << "You are " << age << " years old." << endl;
string name;
cout << "Enter your name: ";
getline(cin, name);
cout << "Your name is registered as " << name << endl;
return 0;
}