1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#include <iostream>
#include <string>
#include <iomanip>
#include "DoublyLinkedList.h"
using namespace std;
int main ()
{
int providedNumbers [] = {1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31};
DoublyLinkedList *list;
Node *current;
list = new DoublyLinkedList (providedNumbers[0]);
for (size_t i = 1; i < sizeof (providedNumbers)/sizeof (*providedNumbers); i++)
list -> addNodeAfter (providedNumbers[i]);
cout<<"The contents of the provided list are "<<providedNumbers<<endl;
bool answer;
cout<<"Would you like to add onto this list, true or false?"<<endl;
cin>>answer;
if (answer == false)
{
cout<<"Ok, thank you"<<endl;
}
if (answer == true)
{
cout<<"Where would you like to add your new node?"<<endl;
string location;
cin>>location;
string beginning;
if (location == beginning)
{
cout<<"What is your added value?"<<endl;
int numberTaken;
cin>>numberTaken;
void DoublyLinkedList ::beginning(int numberTaken)
{
Node *next = head;
Node *previous = head ->previous;
Node *temp2 = new Node (data, previous, next);
size++;
}
}
string end;
if (location == end)
{
cout<<"What is your added value?"<<endl;
int numberTaken;
cin>>numberTaken;
void DoublyLinkedList::end(int numberTaken)
{
Node *next = head ->next;
Node *previous = head;
Node *temp2 = new Node (data, previous, next);
size++;
}
}
system ("pause");
return 0;
}
|