I'm trying to learn C++ and was messing around with inputs, but I ran into some trouble. When creating more than one input, especially with integer inputs, the code would just execute everything, and I really can't tell why. Here's the code:
#include <iostream>
using namespace std;
int main()
{
string name;
cout << "Enter your name: " << endl;
cin >> name;
cout << "Hello " << name << endl;
int age;
cout << "Enter your age: ";
cin >> age;
cout << "You are " << age << " Years old" << endl;
string name2;
cout << "Enter your brothers name: " << endl;
getline(cin, name2);
cout << "Hello " << name2 << endl;
return 0;
}