I'm trying to read some characters from a file, sort them in an array and print them to a new file. The problem I have is nothing is happening. I've been trying to figure it out for a couple of days and I simply cannot come up with a solution or find one since this is how it's done everywhere but for some reason I cannot get it to work.
int main() {
int i = 0, sortType;
char c[100];
cout << "Input the type of sorting you want...\nBubble sort: Press 1 \nSelection sort: Press 2 \nInsertion sort: Press 3 \nQuick sort: Press 4\n\n";
cin >> sortType;
ifstream inFile("AllAlpha.txt");
if (!inFile) {
cout << "\nFile is unavailible";
return 0;
}
for (;; i++) {
if (!inFile.eof())
break;
inFile.get(c[i]);
}
switch (sortType) {
case 1: bubbleSort(c, i);
case 2: selectionSort(c, i);
case 3: insertionSort(c, i);
case 4: quickSort(c, 0, i - 1);
}
ofstream outFile("output.txt");
if (!outFile) {
cout << "\nFile is unavailible";
return 0;
}
for (int j = 0; j < i; j++) {
outFile << c[j] << " ";
}
inFile.close();
outFile.close();
}