// linkedlist1.cpp #include #include #include #define MAXCOUNTIES 21 using namespace std; struct County{ string name; double pop; int area; County *next; }; //typedef County cty; int main() { County *DelawarePtr; DelawarePtr = new County; County *current; current = new County; County *tail; tail = new County; DelawarePtr->name = "Stussex"; DelawarePtr->area = 1; DelawarePtr->pop = 2; DelawarePtr->next = NULL; County *c1; c1 = new County; c1->name = "Sussex"; c1->area = 200; c1->pop = 5; c1->next = NULL; //current = DelawarePtr; current = c1; County *c2; c2 = new County; County *c3; c3 = new County; c1->name = "Sussex"; c1->area = 200; c1->pop = 5; c1->next = c2; (*c2).name = "Kent"; (*c2).area = 300; (*c2).pop = 4; c2->next = c3; c3->name = "New Castle"; (*c3).area = 400; c3->pop = 2; c3->next = 0; // = NULL; = '\0'; cout << c1->name << endl; cout << (c1->next)->name << endl; cout << ((c1->next)->next)->name << endl; /* */ tail = current; while (tail->next != 0) tail = tail->next; cout << "Tail Info" << endl; cout << tail->name << endl; return EXIT_SUCCESS; }