cin >> “no operator matches these operands”

I’ve been working on a C++ project in visual studio 2012 console mode and I keep getting this strange persistent error with the cin function.

Under the >> I get a red line and the program tells me no operator matches these operands. I have initialized all the array elements in a separate method.

Here’s a snippet example (The actual code contains many more variables):

for (int i = 0; i < 14; i++)
{
    cout << "For taxi: " << i+1 << "Please input the taxi rank they are currently parked at, if at all ('Train Station', 'South Walls' or 'Chell Road')" << endl;
    cin >> allTaxiDetails[i].taxiRank;
}

allTaxiDetails is an array, of data type “taxiDetails” which is this structure:

struct taxiDetails { 
    string taxiDriverSurname; 
    int taxiID; 
    int taxiCoordinates; 
    int numberOfSeats; 
    bool taxiContainsCustomerYesNo; 
    bool WheelChairAccessibleVehicle; 
    string taxiRank; 
    fareDetails fareDetailsForTaxi; 
    bool taxiAvaliable; 
};

Leave a Comment