c++ - Code inside loops wont print -
void graph::sortw () { int length = vertices*vertices; int array[length]; (int = 0; < length; i++) { array[i] = 0; cout << array[i]; // nothing prints } cout << "i"; // convert 1d array (int = 0; < vertices; i++) { (int j = 0; j < vertices; j++) { array[i*vertices+j] = matrix[i][j]; cout << array[i*vertices+j] << " "; // nothing prints } } cout << "j"; qsort(array, length, sizeof(int), compare); // (int i=0 ; i<25; i++) // cout << array[i] << endl; // loop prints?! }
i have no idea why output ij
only. sort called in constructor so:
// sort weights using qsort sortw();
anyone have ideas?
i'd suggest put a
cout << vertices;
at beginning of function. guess ist vertices
zero?
Comments
Post a Comment