#include #include const int MAX_LENGTH = 35; typedef char string[MAX_LENGTH]; int shiftCount = 0; string lines[10]; void InsertionSort(string A[], int N) { for (int Unsorted=1; Unsorted0) && (strcmp(A[Loc-1], NextItem)>0); --Loc) { strcpy(A[Loc], A[Loc-1]); shiftCount++; } strcpy(A[Loc], NextItem); } } void main() { int index = 0; int line = 0; ifstream InFile("otherSorts.txt"); while ( InFile.peek() != EOF ) { InFile.getline(lines[line++], MAX_LENGTH); } InFile.close(); InsertionSort(lines, line++); ofstream OutFile("7.txt"); for (int i=0; i<10; i++) { OutFile << lines[i] << "\n"; } OutFile << "\nShift Count = " << shiftCount; OutFile.close(); }