So currently I am trying to separate a string that a user provides to reserve a seat on an airplane, Examples: "2A" "3C". I need to separate that that first number and then the letter into separate variables.
Here is how I obtain the string:
1 2
cout << "Please choose a seat to reserve, with the row number and section seat (Ex: 3A, 2D): " << endl;
cin >> SeatChoice;
My attempt at trying to iterate and pass the materials of that string into separate variables Please help!:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
void SeatFunction(string SeatChoice, char& SectionChoice, char& RowChoice) {
char chr;
for (int i = 0; i < SeatChoice.length(); i++) {
RowChoice = SeatChoice[i];
i++;
SectionChoice = SeatChoice[i];
}
}