0
    cout << "Please enter your date (mm_dd_yyyy" << endl;
    getline(cin, month, day, year);

How do I define several variables (in this case 3) using cin? My homework assignment requests me to be able to get the variables if I type in something such as: "6 10 1973". Anyone know how to achieve this?

Tyler Kay
  • 11
  • 4

1 Answers1

2

It seems simple enough

int month, day, year;
cin >> month >> day >> year;

PS you don't define variables using cin. The variables were defined when you wrote int month, day, year;. cin >> assigns values to variables by reading from the standard input.

john
  • 85,011
  • 4
  • 57
  • 81