#include
#include
struct Car{
std::string model;
unsigned int year;
};
int main(){
using namespace std;
int carNum
Simple reason.
When you do cin >> whatever, a \n is left behind (it was added when you pressed Enter). By default, getline reads until the next \n, so the next read will simply read an empty string.
The solution is to discard that \n. You can do it by putting this:
cin.ignore(numeric_limits::max(),'\n');
Just after the cin >> carNum.
Don't forget to include limits in order to use numeric_limits.