Sorting code wont run properly, please help

#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <Windows.h>
#include <fstream>
#include <string>
#include <cstdlib>

using namespace std;

#include "CMonitor.h"
#include "CFileWorker.h"


int main()
{
CFile You;

You.Heading();
You.InputData();
// You.ReadTheData();
You.Sort();

You.NormalTermination( 27 , 13 );

return 0;
}


##################
class CDisplay
{
public:
CDisplay(){};

void SetTextPosition( int Row , int Col )
{
COORD XY = { Col , Row };
SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ) , XY );
}

void SetTextColor( int Color )
{
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ) , Color );
}

void BackRound()
{
int k,m ;
char Carpet;
Carpet = 176;

SetTextColor(10);
for ( k = 0; k < 48; k++ )
{
for ( m = 0; m < 80; m++ )
{
SetTextPosition( k , m );
cout << Carpet;
}
}
}

void PauseTheScreen()
{
SetTextPosition( 26 , 24 );
SetTextColor(9);
system("pause");
}


private:

};
###############################
class CFile
{
public:
CFile(){};

void OpenFile() { ReadWrite.open( "Temp01.txt" , ios::in | ios::out | ios::app ) ;}

void CloseFile(){ ReadWrite.close() ;}

void OpenFileSort() { ReadWrite.open( "Temp0A.txt" , ios::in | ios::out | ios::app ) ;}

void CloseFileSort(){ ReadWrite.close() ;}

void CleanTheBuffer()
{
int k;
for ( k = 0; k < 64; k++ )
{
Buffer[ k ] = 32;
}
Buffer[ 63 ] = '\0';
}

void FormatAndWriteData()
{
int k;

CleanTheBuffer();
for ( k = 0; k < SSN.length(); k++ )
{
Buffer[ k ] = SSN[ k ];
}
for ( k = 0; k < FirstName.length(); k++ )
{
Buffer[ k + 11 ] = FirstName[ k ];
}
for ( k = 0; k < LastName.length(); k++ )
{
Buffer[ k + 26 ] = LastName[ k ];
}
for ( k = 0; k < ZipCode.length(); k++ )
{
Buffer[ k + 46 ] = ZipCode[ k ];
}
for ( k = 0; k < DOB.length(); k++ )
{
Buffer[ k + 51 ] = DOB[ k ];
}
for ( k = 0; k < State.length(); k++ )
{
Buffer[ k + 61 ] = State[ k ];
}

OpenFile();
ReadWrite.seekp( 0 , ios::end );
ReadWrite.write( Buffer , 63 );
CloseFile();
}

void InputData()
{
bool WhileInputting;

Me.SetTextColor(14);

WhileInputting = true;
while (WhileInputting)
{
Me.SetTextPosition( 12 , 16 );
cout << "Social Security Number : ";
Me.SetTextPosition( 14 , 16 );
cout << "First Name : ";
Me.SetTextPosition( 16 , 16 );
cout << "Last Name : ";
Me.SetTextPosition( 18 , 16 );
cout << "ZipCode : ";
Me.SetTextPosition( 20 , 16 );
cout << "Date of Birth : ";
Me.SetTextPosition( 22 , 16 );
cout << "State : ";


Me.SetTextPosition( 12 , 41 );
cin >> SSN;

if (SSN[ 0 ] == 'Z' && SSN[ 1 ] == 'Z' && SSN[ 2 ] == 'Z' )
{
WhileInputting = false;
}
else
{
Me.SetTextPosition( 14 , 41 );
cin >> FirstName;

Me.SetTextPosition( 16 , 41 );
cin >> LastName;

Me.SetTextPosition( 18 , 41 );
cin >> ZipCode;

Me.SetTextPosition( 20 , 41 );
cin >> DOB;

Me.SetTextPosition( 22 , 41 );
cin >> State;

FormatAndWriteData();
}
}

}

void ReadTheData()
{
int ToatalReacords , k;

OpenFile();
ReadWrite.seekg( 0 , ios::end );
ToatalReacords = ReadWrite.tellg()/63;

k = 0;

while ( k < ToatalReacords )
{
ReadWrite.seekp( k * 63 );
ReadWrite.read( Buffer , 63 );
DisplayData();
k = k + 1;
}
CloseFile();
}

void DisplayData()
{
string Holder;
Holder = Buffer;

Me.SetTextColor( 12 );

Me.SetTextPosition( 12 , 16 );
cout << "Social Security Number : ";
Me.SetTextPosition( 14 , 16 );
cout << "First Name : ";
Me.SetTextPosition( 16 , 16 );
cout << "Last Name : ";
Me.SetTextPosition( 18 , 16 );
cout << "ZipCode : ";
Me.SetTextPosition( 20 , 16 );
cout << "Date of Birth : ";
Me.SetTextPosition( 22 , 16 );
cout << "State : ";

Me.SetTextPosition( 12 , 41 );
cout << Holder.substr( 0 , 11 );

Me.SetTextPosition( 14 , 41 );
cout << Holder.substr( 11 , 15 );

Me.SetTextPosition( 16 , 41 );
cout << Holder.substr( 26 , 20 );

Me.SetTextPosition( 18 , 41 );
cout << Holder.substr( 46 , 5 );

Me.SetTextPosition( 20 , 41 );
cout << Holder.substr( 51 , 10 );

Me.SetTextPosition( 22 , 41 );
cout << Holder.substr( 61 , 2 );

Me.PauseTheScreen();
}


void Heading()
{
Me.BackRound();

Me.SetTextColor(15);

Me.SetTextPosition(1,25);
cout << "The Colleges of Ventura County";

Me.SetTextPosition(2,31);
cout << "College of Ventura";

Me.SetTextPosition(3,22);
cout << "CS V13 - Object Oriented Programming";

Me.SetTextPosition(4,34);
cout << "Spring 2015";

Me.SetTextPosition(6,33);
cout << "Michael Bendot";
}


void Sort()
{
char Biffer[50][64];
int k , m , p ;
bool WhileSorting;
int SSNOne , SSNTwo ;
char SSNBuffer[50];

WhileSorting = true;

OpenFile();
// ReadWrite.seekg( 0 , ios::end );
// ToatalReacords = ReadWrite.tellg() / 63;

k = 0;
while ( k < 50 )
{
ReadWrite.seekp( k * 63 );
ReadWrite.read( Buffer , 63 );
for ( m = 0 ; m < 64; m++ )
{
Biffer[ k ][ m ] = Buffer[ m ];
}
Biffer[ k ][ 63 ] = '\0';
k = k + 1;
}
CloseFile();

while ( WhileSorting )
{
WhileSorting = false;
for ( k = 0; k < 49; k++ )
{
p = 0;
for ( m = 0; m < 11; m++ )
{
if ( m != 3 && m != 6 )
{
SSNBuffer[ p ] = Biffer[ k ][ m ];
p++;
}
}
SSNOne = atoi( SSNBuffer );
p = 0;
for ( m = 0; m < 11; m++ )
{
if ( m != 3 && m != 6 )
{
SSNBuffer[ p ] = Biffer[ k+1 ][ m ];
p++;
}
}

SSNTwo = atoi( SSNBuffer );
if ( SSNOne > SSNTwo );
{
for ( m = 0; m < 64; m++ )
{
Buffer[ m ] = Biffer[ k ][ m ];
Biffer[ k ][ m ] = Biffer[ k+1 ][ m ];
Biffer[ k+1 ][ m ] = Buffer[ m ];
WhileSorting = true;
}
}
}
}
OpenFileSort();

for ( k = 0; k < 50; k++ )
{
ReadWrite.seekp( 0, ios::end );
ReadWrite.write( Biffer[ k ] , 63 );
}

CloseFileSort();
}

void NormalTermination( int Row , int Color )
{
Me.SetTextPosition( Row , 24 );
Me.SetTextColor ( Color );
system("pause");
}

private:
fstream ReadWrite ;
string FirstName ;
string LastName ;
string SSN ;
string ZipCode ;
string DOB ;
string State ;
char Buffer [ 64 ] ;
CDisplay Me ;
};
I need to sort 50 records and everything runs perfectly until i include the 'SORT' program, then the cursor just stops moving
Topic archived. No new replies allowed.