Originally Posted by xpi0t0s
> Is there any way to check to determine the greatest value that is chosen to be the pivot using this sample code you provided?
I don't understand the question. The code does both; it tells you what the maximum value is (max) and what row it is on (loc).
> How would you swap the rows?
Same way I would swap the values of two variables, but done with arrays in a loop. This is one way to swap two variables; it uses a 3rd for temporary storage:
int a=10, b=20, c;
c=a; // make a safe copy of a
a=b; // overwrite a with b
b=c; // overwrite b with the safe copy of a
printf("%d %d",a,b); // will display 20,10
Thanks...ok let me try to explain what I meant. That question wasn't worded correctly.. I meant to say how would you use a cout<< statement to actually check what the value is?