multiple input for a single variable?

Hello, I was wondering if there is a way to allow more than one input for a single variable. This would help out a lot for the homework that I am doing where I have two string variables separated by a space. For instance, I am entering a manufacturer and model of a certain car and I have these defined as two separate variables. It looks something like this:

cout << "Enter manufacturer and model of car: ";
cin >> carManufacturer >> carModel;

Now for example I could enter something like Chevrolet Volt, the manufacturer and model as the input. But if I want to enter a model that is two words like say Porsche 911 GT3, my program gets messed up. Is there any way to make this a one size fits all kind of input, where I could make the model any number of spaced words? Don't give any code, but sort of push me in a direction where I could make this sort of thing work.
Hello, Kris Cell.

A single object cannot contain more than one value, unless it's an array, or vector.
You probibly want something like this:
1
2
3
4
5
6
7
8
9
struct Car {
    string manufacturer;
    string model;
};

//then later in main...
Car car;
cout << ...;
cin >> car.manufacturer >> car.model;
Topic archived. No new replies allowed.