Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // List Lab.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <iostream>
- #include "list.h"
- using namespace std;
- int main()
- {
- int choice = 10;
- do {
- 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: ";
- cin >> choice;
- if (choice == 0) {
- exit(0);
- }
- else if (choice == 1) {
- Rec myRec;
- char firstName[15], lastName[15], idbuffer[15];
- cout << "Enter the ID: " << endl;
- cin >> idbuffer;
- myRec.id = new char[sizeof(idbuffer) + 1];
- strcpy_s(myRec.id, sizeof(idbuffer), idbuffer);
- cout << "Enter the firstname: " << endl;
- cin >> myRec.firstname;
- cout << "Enter the lastname: " << endl;
- cin >> myRec.lastname;
- AddItem(myRec);
- }
- else if (choice == 2) {
- char IDptr[15];
- cout << "Enter an ID that you would like to delete: " << endl;
- cin >> IDptr;
- DeleteItem(IDptr);
- }
- else if (choice == 3) {
- int answer = 0;
- cout << "Enter 0 for ascending, 1 for descending: " << endl;
- cin >> answer;
- PrintList(answer);
- }
- else {
- cout << "please enter a valid input.";
- }
- } while (choice != 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment