Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void getInfo(){
- string Name, Zip, AddressInfo; // Passed to Vectors after loop completes
- bool run = true;
- char save, repeat; // Used for if loops that prompt user response
- while (run = true){ // Loop will get data sets until user terminates the loop
- cout << endl << "Please insert a name: ";
- getline(cin,Name);
- cout << "Please insert an address: ";
- getline(cin,AddressInfo);
- cout << "Please insert a ZIP code: ";
- getline(cin,Zip);
- cout << endl << "Do you wish to save this data? <y/n>: ";
- cin >> save;
- if(toupper(save) == 'Y'){ //Confirms if user wishes to save data set
- Names[counter] = Name;
- ZipCode[counter] = Zip;
- Address[counter] = AddressInfo;
- counter++;
- }
- cout << "Do you wish to add another data set? <y/n>: ";
- cin >> repeat;
- if(toupper(repeat) == 'N'){ //Confirms if user wishes to add a new data set
- run = false;
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement