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 ];
}
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");
}