Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. void getInfo(){
  2. string Name, Zip, AddressInfo; // Passed to Vectors after loop completes
  3. bool run = true;
  4. char save, repeat; // Used for if loops that prompt user response
  5. while (run = true){ // Loop will get data sets until user terminates the loop
  6. cout << endl << "Please insert a name: ";
  7. getline(cin,Name);
  8. cout << "Please insert an address: ";
  9. getline(cin,AddressInfo);
  10. cout << "Please insert a ZIP code: ";
  11. getline(cin,Zip);
  12. cout << endl << "Do you wish to save this data? <y/n>: ";
  13. cin >> save;
  14. if(toupper(save) == 'Y'){ //Confirms if user wishes to save data set
  15. Names[counter] = Name;
  16. ZipCode[counter] = Zip;
  17. Address[counter] = AddressInfo;
  18. counter++;
  19. }
  20. cout << "Do you wish to add another data set? <y/n>: ";
  21. cin >> repeat;
  22. if(toupper(repeat) == 'N'){ //Confirms if user wishes to add a new data set
  23. run = false;
  24. break;
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement