I was wondering if I am on the right track with this one.
I have to sort even and odd input numbers of an array, placing the even numbers at the front of the array, and the odd at the end.
Code:for (iCntr = 0; iCntr < DIM; iCntr++) { printf("%d > ", iCntr); fscanf(stdin, "%d", &iInput[iCntr]); } for (iCntr = 0; iCntr < DIM; iCntr++) { if (iCntr % 2) iOdd = iCntr; else iEven = iCntr; } } for (iOdd < DIM; iOdd++) { printf(" %d \n", iInput[iOdd]); } for (iEven < DIM; iEven++) { printf(" %d \n", iInput[iEven]); }
Does this look even remotely correct to anyone?
I know the printf part isn't because I keep getting errors, but I have to work more on that.
Thanks for your time.



LinkBack URL
About LinkBacks


