Ejemplo n.º 1
0
void problem2(){
	int column;
	Prob2Sort<char> rc;
	bool ascending = true;
	ifstream infile;
	infile.open("Problem2.txt", ios::in);
	char *ch = new char[10 * 16];
	char *ch2p = ch;

	cout << "The start of Problem 2, the sorting problem" << endl;
	
	while (infile.get(*ch)){ cout << *ch; ch++; }
	infile.close();
	cout << endl;

	cout << "Sorting on which column" << endl;	
	cin >> column;

	char *SortCol = rc.sortArray(ch2p, 10, 16, column, ascending);

	for (int i = 0; i<10; i++)
	{
		for (int j = 0; j<16; j++)
		{
			cout << SortCol[i * 16 + j];
		}
	}
	delete[]SortCol;
	cout << endl;
	
}
Ejemplo n.º 2
0
void problem2(){
    cout<<"The start of Problem 2, the sorting problem"<<endl;
    Prob2Sort<char> rc;
    bool ascending=true;
    ifstream infile;
    infile.open("Problem2.txt", ios::in);
    char *ch2 = new char[10*17];
    char *ch2p = ch2;
    int i=0;
    while (infile.get(ch2[i])) {cout<<ch2[i];ch2++;}
    infile.close();
    cout<<endl;
    cout<<"Sorting on which column"<<endl;
    int column;
    cin>>column;
    char *zc = rc.sortArray(ch2p, 10, 17, column, ascending);
    for (int i=0;i<10;i++) {
        for (int j=0; j<17;j++) {
            cout<<zc[i*17+j];
        }
    }
    delete []zc;
    cout<<endl;

}