int main() { int i,size=15; ElementList E; for(i=0;i<size;i++) { E[i].id=i; E[i].regstatus=(i%3); //0 success, 1 = deny, 2 = conflict } // R containing All (size number) registered student records ListHead ks, kd, kc; createStore(); ks=createList(); kd=createList(); kc=createList(); for (i = 0; i < size; i++) { if (E[i].regstatus == 2) { insertNode (E[i], kd); } else if (E[i].regstatus == 0) { insertNode (E[i], ks); } else { insertNode (E[i], kc); } } printf("DENY LIST\n"); printList(kd); printf("SUCCESS LIST\n"); printList(ks); printf("CONFLICT LIST\n"); printList(kc); printf("COMPLETE LIST\n"); printStore(); deleteNode(E[3],ks); deleteNode(E[4],kd); deleteNode(E[5],kc); printf("DENY LIST After Deletion\n"); printList(kd); printf("SUCCESS LIST After Deletion\n"); printList(ks); printf("CONFLICT LIST After Deletion\n"); printList(kc); printf("COMPLETE LIST After Deletion\n"); printStore(); }
void ReadData(Tree *cleanTree) //Author: Alexi { Tree tree = *cleanTree; int Sentinel = 0, counter = 0, itemCount = 0; string name; Store tempStore; while (Sentinel != 2) //Going to represent 16 16 16, need to rework logic slightly { int x, y, z, itemNumber; x = 0; y = 0; z = 0; itemNumber = 0; //cout << "Reading in data\n"; cin>>x; if (x==16) Sentinel++; cin>>y; if (y==16) Sentinel++; cin>>z; if (z==16) Sentinel++; if (Sentinel==3){ break; } else { Sentinel=0; } cin>>itemNumber; for (counter = 0; counter < itemNumber; counter++) { name = " "; itemCount = 0; cin>>name; cin>>itemCount; StorePtr tempStorePtr = new Store(); tempStorePtr->x = x; tempStorePtr->y = y; tempStorePtr->z = z; tempStorePtr->itemCount = itemCount; tempStorePtr->nextStore = NULL; //Store tempStore = *tempStorePtr; ItemPtr tempItem = new Item(name); if (debugRead){ cout << "\nPrinting temporary item and store\n"; tempItem->printItem(); printStore(tempStorePtr); } if (debugRead){ //tree.PrintTree(); cout << "Adding item:\n"; } tree.addItem(tempItem, tempStorePtr); //cout << "\n TREE \n"; //tree.PrintTree(); } if (debugRead) cout << "Printing tree:\n"; } //end for //tree.PrintTree(); *cleanTree = tree; } //end ReadData