How to search a c-string

My project is to create a program that reads two different files named hw1_1 and hw1_2 and the files contain random numbers. The one contains 30 random and the other 20 random numbers. I have all the numbers being wrote into the file using "ifstream" and "ofstream" functions.The object is to read those two files and then write them into a file called output. The numbers have to be sorted in ascending order. The thing that i dont understand is how to sort the c-string in the output file using selection sort. I know how to use selection sort but how do you convert it into an array to be able to sort. Anyone have any suggestions well appreciated thanks.

Kory
#include <fstream>
#include <iostream>

using namespace std;
//void selectionsort(int [], int);

int main()
{
char group1[2000];
char group2[2000];
char next[2000];

ifstream ifs2;
ifstream ifs;
ifstream ifs1;
ofstream ofs;
ofstream ofs2;


ifs.open("hw1_input1.txt");
ifs1.open("hw1_input2.txt");
ofs.open("output.txt");
ofs2.open("temp.txt");



while(ifs.getline(next, 2000))
{
ifs.get(group1, 2000);
ofs << group1 << "\t";



ofs << next;


}

while(ifs1.getline(next, 2000))
{
ifs1.get(group2, 2000);
ofs << group2 << "\t";

ofs << next;
}

ifs2.open("output.txt");
ifs2.get(next, 2000);


ifs.close();
ifs1.close();
ofs.close();

return 0;
}

/*void selectionsort(int a[], int size)
{



}*/
Topic archived. No new replies allowed.