Facebook
From Diminutive Meerkat, 4 Months ago, written in C++.
Embed
Download Paste or View Raw
Hits: 135
  1.  
  2. Czemu tutaj referencja? do pliku?
  3.  
  4. void vfun_ReadFile(ifstream &fsFile, s_Vertices *svVerticeTab) {
  5.         int iVertice1, iVertice2;
  6.  
  7.         while (!fsFile.eof()) {
  8.                 fsFile >> iVertice1;
  9.                 fsFile >> iVertice2;
  10.                 vfun_AddNeighbour(svVerticeTab[iVertice1 - 1], iVertice2);
  11.                 vfun_AddNeighbour(svVerticeTab[iVertice2 - 1], iVertice1);
  12.         }
  13. }
  14.  
  15.  
  16. Czemu tu referencja?
  17.  
  18. void vfun_AddNeighbour(s_Vertices &svVertice, int iNeighbourVertice) {
  19.         svVertice.iRank++;
  20.  
  21.         if (svVertice.HeadNeighboursList == nullptr) {
  22.                 s_List* tempList = new s_List;
  23.                 tempList->iNeighbourVertices = iNeighbourVertice;
  24.                 svVertice.HeadNeighboursList = tempList;
  25.         }
  26.         else {
  27.                 s_List* tempList = svVertice.HeadNeighboursList;
  28.                 while (tempList->slNext != nullptr) tempList = tempList->slNext;
  29.                 s_List* newList = new s_List;
  30.                 newList->iNeighbourVertices = iNeighbourVertice;
  31.                 tempList->slNext = newList;
  32.         }
  33. }