Guest User

Untitled

a guest
Mar 6th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. // List Lab.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3. #include <iostream>
  4. #include "list.h"
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int choice = 10;
  10. do {
  11. cout << "What would you like to do?(1 to add an item, 2 to delete an item, 3 to print the list, 0 to quit: ";
  12. cin >> choice;
  13. if (choice == 0) {
  14. exit(0);
  15. }
  16. else if (choice == 1) {
  17. Rec myRec;
  18. char firstName[15], lastName[15], idbuffer[15];
  19. cout << "Enter the ID: " << endl;
  20. cin >> idbuffer;
  21. myRec.id = new char[sizeof(idbuffer) + 1];
  22. strcpy_s(myRec.id, sizeof(idbuffer), idbuffer);
  23. cout << "Enter the firstname: " << endl;
  24. cin >> myRec.firstname;
  25. cout << "Enter the lastname: " << endl;
  26. cin >> myRec.lastname;
  27. AddItem(myRec);
  28. }
  29. else if (choice == 2) {
  30. char IDptr[15];
  31. cout << "Enter an ID that you would like to delete: " << endl;
  32. cin >> IDptr;
  33. DeleteItem(IDptr);
  34. }
  35. else if (choice == 3) {
  36. int answer = 0;
  37. cout << "Enter 0 for ascending, 1 for descending: " << endl;
  38. cin >> answer;
  39. PrintList(answer);
  40. }
  41. else {
  42. cout << "please enter a valid input.";
  43. }
  44.  
  45. } while (choice != 0);
  46. }
Advertisement
Add Comment
Please, Sign In to add comment