//Syed Rais Ahmad //CIS 651 //Shortest distance between two nodes. #include "stdafx.h" #include #define INFINITY 9999 #define MAXNODES 5 #define MEMBER 1 #define NONMEMBER 0 class llNode { public: int value; llNode * nxtNode; }; //link list defined class lList { private: llNode * head; public: lList(); ~lList(); void Insert(int); bool Find(int); }; //create head and put NULL values in it. lList::lList() { head = new llNode; head->nxtNode=NULL; head->value=NULL; } //Destroy/free list/memory lList::~lList() { delete head; } //Insert to the tail of link list void lList::Insert(int InsertInt) { llNode * ptr=head; while(ptr->nxtNode) //go all the way to NULL-pointing/last node ptr=ptr->nxtNode; ptr->nxtNode=new llNode; ptr=ptr->nxtNode; // temporary pointer holds new value's Insertress ptr->value=InsertInt; // Insert a value to new value ptr->nxtNode=NULL; //make next value of new value point to NULL } bool lList::Find(int n) { llNode * ptr=head; bool result=false; while((ptr=ptr->nxtNode) && !result) if (ptr->value==n) result=true; return result; } class wtMatrix { int wM[MAXNODES][MAXNODES]; Weight(int,int); public: ShortPath(int,int); wtMatrix(); }; wtMatrix::wtMatrix() { int i=0,j=0; for(i=0;i