Below I am setting up a y/n question in the program, I know I need an identifier named i
for the cin
line to work in the if
's. However, I'm not sure where to put my identifier.
#include <iostream>
#include <string>
using std::string, std::cin, std::cout, std::endl;
int main() {
const int MaxNum = 3;
int simcard;
string familyone[MaxNum] = {
"Name One",
"Name Two",
"Name Three"
};
int famnumone[MaxNum];
int choice;
string familytwo[MaxNum] = {
"Name One",
"Name Two",
"Name Three"
};
int famnumtwo[MaxNum];
string familythree[MaxNum] = {
"Name One",
"Name Two",
"Name Three"
};
int famnumthree[MaxNum];
string phonetype[MaxNum] = {
"Iphone",
"Android",
"Random Phone"
};
string familysim[MaxNum] = {
"Family one Sim",
"Family two Sim",
"Family Three Sim"
};
string simtype[MaxNum] = {
"Iphone SIM",
"Android SIM",
"Random Phone SIM"
};
//Here we have information for each family members name to later identify who each phone belongs too
cout << "SIM card matching tool\n";
cout << "Enter Family One Names ==>";
for (int i = 0; i < MaxNum; i++) {
getline(cin, familyone[i]);
}
do {
cout << "would you like to continue to the sim/y, or would you like to add another family/n" << endl;
cin >> choice;
choice = tolower(choice);
} while (choice != 'n' && choice != 'y');
if (choice == 'n') {
cin >> familytwo[i];
if (choice == 'y')
cin >> simtype[i];
}
//add y/n below or possibly add a more complex anwser "if you would like to continue with the SIM type SIM or if you would like to add another family type family
cout << "Would you like to continue to the SIM/y, or would you like to add another family/n";
}