Skip to content

Instantly share code, notes, and snippets.

@utjacob
Created March 18, 2014 03:28
Show Gist options
  • Save utjacob/9613051 to your computer and use it in GitHub Desktop.
Save utjacob/9613051 to your computer and use it in GitHub Desktop.
void stockSort(char a) {
int i =1;
int j =1;
int flag = 1;
int yearTemp = 0;
int stockTemp = 0;
string modelTemp = "null";
//MakeTemp
//MilesTemp
//PriceTemp
for(i=1; (i <= MAX) && flag; i++) { // i = 3,
flag = 0; //set to false
for(j =0; j < (MAX -1); j++) {
if(stockAry[j+1] > stockAry[j]) {
yearTemp = yearAry[j];
stockTemp = stockAry[j];
modelTemp = modelAry[j];
//MakeTemp
//MilesTemp
//PriceTemp
yearAry[j] = yearAry[j+1];
stockAry[j] = stockAry[j+1];
modelAry[j] = modelTemp[j+1];
//MakeAry j = j+1
//MilesAry j = j+1
//PriceAry j = j+1
yearAry[j+1] = yearTemp;
stockAry[j+1] = stockTemp;
modelAry[j+1] = modelTemp;
//MakeAry j+1 = temp
//MilesAry j+1 = temp
//PriceAry j+1 = temp
flag = 1;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment