input files: with multiple data types

while attempting to write a mock database management program. i can not figure out how to sort a .dat file with multiple data types. i can not find anything on the web on how to sort it. i tried loading the file into a string array[]; then sorting it afterwards. but my most recent code is:



class CustomerInfo
{

private:
int count = 0;
string cust_Id[3];
string customer_Name[18];
string state[2];
string due_Date[10];
char discount_Code[1];
double balance_Due[];
public:
CustomerInfo();
void loadArray();
void DisplayCustomerInfo();
int binSearch(int);
double getCustomer_Id(int);

void CustomerInfo::loadArray()
{
ifstream arrayIn;

arrayIn.open ("ASSIGNV1.dat");
if (arrayIn.is_open())
{
arrayIn
>> cust_Id[count]
>> customer_Name[count]
>> state[count]
>> discount_Code[count]
>> balance_Due[count]
>> due_Date[count];

while (!arrayIn.eof())
{
count = count + 1;

arrayIn
>>cust_Id[count]
>> customer_Name[count]
>> state[count]
>> discount_Code[count]
>> balance_Due[count]
>> due_Date[count];

}//end while
arrayIn.close();
}
//end if file opened

else
{
count = -1;
cout << "File Failed to open.";
}


}//end of loadArray
Topic archived. No new replies allowed.