arrays - Using a class function inside another function in the same class in C++ -


how go using function swap inside class function rotate matrix? haven't been able find answers this.

void matrix::swap(int& a, int& b) {     int temp = a;     = b;     b = temp; }  void matrix::rotatematrix() {      int n = m_matrixsize;     int level = 0;     int last = n-1;     int numoflevels = n/2 ;      while(level < numoflevels)     {         for(int = level;i < last; i++)         {             swap(matrix[level][i], matrix[i] [last]);             swap(matrix[level][i], matrix[last][last - + level]);             swap(matrix[level][i], matrix[ last - + level][level]);         }//end         ++level;         --last;      }//end while }//end rotatematrix 

like mentioned above had use scope operator in front of swap. matrix::swap, fixed problem. had name of array incorrectly labeled.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -