please help i think d error is in inputtin d values into d linked list! D files are attached

Recommended Answers

All 4 Replies

This is no way to ask a question. What the hell are we supposed to do with "i think d error is in inputtin d values into d linked list" ?
Post your code using code tags (don't just upload some files) and then tell us
1. what the code is supposed to do (input/ouput)
2. What the code is actually doing
3. (optional) tell us where you think the problem is.

Here's a sort of 'forum-manual', you might benefit from reading it.

Also, writing in something approaching proper English is appreciated. Text- or leet-speak is generally not appreciated.

ok!

the code reads i in data about each flight(given on a seperate line 4 each flight) so i hav 2 build a graph 2 find shortest distance!

so i create a vertex that stores a given startin pt and a linked list that stores all its possible end pts along with cost,time to get from start vertex 2 en vertex!

but i dont no wat i did wrong?????

int buildGraph(FILE * in1,Graph G,int n)
{

  EdgePtr addInPlace(EdgePtr,char[], double, double, char[]);  


  int i;   
  char temp[MaxWordSize + 1];   
  char ePort[MaxWordSize + 1], dPort[MaxWordSize + 1]; 
  double d,c;  

  EdgePtr top = NULL;

  fscanf(in1,"%s",&temp);

  while(strcmp("END",temp)!=0)
  {

    fscanf(in1, "%s",&ePort);
    fscanf(in1, "%s",&dPort);
    fscanf(in1, "%lf",&d);
    fscanf(in1, "%lf",&c);


    for(i=0; i <= n; i++)
    {

    if(strcmp(G->vertices[i].embarkmentPort,ePort)!=0)
      {
        n++;

       G->vertices[n] = newVertex ("");

       strcpy(G->vertices[n].embarkmentPort,ePort);

       top = addInPlace(G->vertices[n].Destinations,temp, d, c, dPort);


       }//end if

    else
     {

      top = addInPlace(G->vertices[i].Destinations,temp, d, c, dPort);

      }//end else

    }//end for

  fscanf(in1,"%s",&temp);

}//end while                  
 return n;   
}//end buildGraph  

If your to lazy to click the link(s) I gave you, then I'm to lazy to try and help.
Use. Code. Tags.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.