What I am trying to do is:

a) The total number of trucks sold and total truck sales for each
month at all dealerships.

b) The total number of cars sold and total car sales at each
dealership for each month.

c) The most popular pick-up sold at all dealerships.

d) The dealership with the most SUV’s sold in each month.

e) The most popular mid-size car sold at all dealerships.


A sample of the output file looks like:

SUV Escape 03219380
Full Fusion 09117145
Mid-SizeFusion 02317145
Small Focus 09317145
SUV Explorer 11221975
Small Focus 06221975
Full Taurus 08220830
Pick-Up F-150 12321325
Full Mustang 10116470
Full Fusion 01217145
SUV Escape 10219380
SUV Excursion 01238035
Mid-SizeTaurus 07320830
Full Mustang 05216470


in the number at the end of each line the first two numbers represents the month the vehicle was sold, the third number is the dealership(there is only 1-3) and the remaining numbers are the price of the vehicle.




What I have so far is:
Code:
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <conio>

using namespace std;
ofstream out;
struct cars 
{
  char type[9];
  char model[15];
  char year[3];
  char dealership[2];
  double price;
};


void ReadString(ifstream&, char[],int);

int main()
{
cars hi;  
ifstream input;
// ofstream out;

out.open("cars.out");
input.open("cars.dat");
ReadString(input,hi.type,8);
while(!input.eof())
{
  ReadString(input,hi.model,14); 
  ReadString(input,hi.year,2);
  ReadString(input,hi.dealership,1); 
  input >> hi.price;
  out << hi.price << endl;
  input.get();
  ReadString(input,hi.type,8);
}

input.close();
out.close(); 
return 0; 
}
/*********************************************************/
void ReadString(ifstream& input, char line[],int Limit)
{
int I;  

I = 0;
while (I < Limit && !input.eof())
  {
  input.get(line[I]);
  I++; 
  }
if (!input.eof())
{  
  line[I] = '\0';
   out << line; 
}
}
I think that i need to convert the char to int somehow and keep track of each type of sale.