convert program to object oriented

THIS IS WORKING PROGRAM..NEED HELP TO CONVERT IT INTO OBJECT ORIENTED.

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
#define MAX 50

int main()
{
int cnt = 0, k, i;
char temp[31];
char name[MAX][31], phonenum[MAX][21];
fstream infile("phone.txt");
if (infile.fail())
{
cerr << "Failed to open data file\n";
return 1;
}
// Read phone records from the file into arrays.
while (! infile.eof())
{
infile >> name[cnt] >> phonenum[cnt];
++cnt;
} // while
infile.close(); // close the data file

// Sort the records in alphabetical order by names.
for (i=0; i < cnt-1; ++i)
for (k=i+1; k<cnt; ++k)
if (strcmp(name[i], name[k]) > 0)
{ /* swap */
strcpy(temp, name[i]);
strcpy(name[i], name[k]);
strcpy(name[k], temp);
strcpy(temp, phonenum[i]);
strcpy(phonenum[i], phonenum[k]);
strcpy(phonenum[k], temp);
}

// Display the sorted records.
for (k=0; k < cnt; ++k)
cout << name[k] << " " << phonenum[k] << endl;

// Sort the records in ascending order by phone numbers.
for (i=0; i < cnt-1; ++i)
for (k=i+1; k<cnt; ++k)
if (strcmp(phonenum[i], phonenum[k]) > 0)
{ /* swap */
strcpy(temp, name[i]);
strcpy(name[i], name[k]);
strcpy(name[k], temp);
strcpy(temp, phonenum[i]);
strcpy(phonenum[i], phonenum[k]);
strcpy(phonenum[k], temp);
}

// Display the sorted records.
for (k=0; k < cnt; ++k)
cout << name[k] << " " << phonenum[k] << endl;

return 0;
} // main


PLEASE HELP SOMEONE
http://www.cplusplus.com/doc/tutorial/classes/

If you intend to have someone do all the work, I doubt it will be free. If you just have a few errors you need help with, on the other hand...
got u..but i just needed someone to start out. basically give me ideas..please
for one convert your char arrays to strings and use the corresponding string methods for the C-style string fcns. That is all I can see at the moment. also use [ c o d e ] [ / c o d e] tags (w/out spaces)
Topic archived. No new replies allowed.