Can anybody Fix MY Error ?

// Inheritance to create two new classes.cpp : Defines the entry point for the console application.
//
#include "Kind.h"
#include "stdafx.h"
#include "Car.h"
#include "FreightCar.h"
#include "PassengerCar.h"
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
#include<cstring>

using namespace std;

class Car
{
protected:
string Type;
string ARR;
int number;
string kind;
string loaded;
string destination;
string car;
string Cartemp;
string FreightCar;
string FreightCartemp;
string PassengerCar;

public:


//default constructor
Car(void);
//a copy constructor
Car(const Car &obj);
//constructor that has five parameters
Car(string newType,string newARR,string neworder,int newnumber,string newloaded,string newdestination);
~Car(void);
void buildCar(string newType, string neworder,string newARR,int newnumber,string newloaded,string newdestination);
void setKind(string kind,string Freightcar,string Cartemp,string FreightCartemp,string PassengerCar,string PassengerCartemp );
void setUpCar();







};



int main()
{
int FreightCar;
string line;
ifstream carsFile ("cars.txt");
cout<<"Type order ARR number kind loaded destination\n";
if (carsFile.is_open())
{
while (carsFile.good() )
{
getline (carsFile,line);
char* cstr = new char [line.size()+1];
strcpy (cstr, line.c_str());
char* splitter= strtok(cstr,"|");
int count=0;

string Type;
string order;
string ARR;
int number;
string kind;
string loaded;
string destination;

while (splitter != NULL)
{
if(count==0){
Type=splitter;

}
if(count==1){
order=splitter;

}
if(count==2){
ARR=splitter;

}
if(count==3){
number=atoi(splitter);

}
if(count==4){
kind=splitter;

}
if(count==5){
loaded=splitter;

}

if(count==6){
destination=splitter;

count=-1;
}
splitter = strtok (NULL, "|");
count++;
}

if(strcmp(Type.c_str(),"Car")==0){
Car Cartemp(Type,order,ARR,number,loaded,destination);
Cartemp.setKind(kind);
Cartemp.setUpCar();

}
if(strcmp(Type.c_str(),"FreightCar")==0){
FreightCar ,FreightCartemp(Type,order,kind,ARR,number,loaded,destination);
FreightCartemp.setKind(kind);
FreightCartemp.setUpCar();
}
if(strcmp(Type.c_str(),"PassengerCar")==0){
PassengerCar, PassengerCartemp(order,ARR,number,loaded,destination);
PassengerCartemp.setKind(kind);
PassengerCartemp.setUpCar();
}

}
carsFile.close();//close file
}
else{ cout << "No such file\n\n";}


//delay
system("pause");

return 0;
}




Car::Car(void)
{
this->Type="";
this->ARR="";
this->number=0;
this->loaded="";
this->destination="";
}

Car::Car(const Car &obj){
*this=obj;
}
Car::~Car(void)
{
}

Car::Car(string newType,string newARR,int newnumber,string newloaded,string newdestination){
this->Type=newType;
this->ARR=newARR;
this->number=newnumber;
this->loaded=newloaded;
this->destination=newdestination;
}
void Car::buildCar(string newType,string newARR,int newnumber,string newloaded,string newdestination){
this->Type=newType;
this->ARR=newARR;
this->number=newnumber;
this->loaded=newloaded;
this->destination=newdestination;
}
void Car::setUpCar(){
cout<<this->Type<<"\t"<<this->ARR<<"\t"<<this->number<<"\t"<<left<<setw(15)<<KIND_ARRAY[this->kind]<<"\t"<<this->loaded<<"\t"<<"\t"<<this->destination<<"\n";
}
void Car::setKind(string kind){
this->kind=other;
if(strcmp(kind.c_str(),"business")==0){
this->kind=business;
}
if(strcmp(kind.c_str(),"maintenance")==0){
this->kind=maintenance;
}

}






};







What's the problem?

Also, use [code] tags to preserve indenting
You have lots of errors. for example:

Cartemp.setKind(kind);
You're passing setKind a string, but you've defined it to take 6 parameters:

void setKind(string kind,string Freightcar,string Cartemp,string FreightCartemp,string PassengerCar,string PassengerCartemp );

As stewbond said, be more specific with issues.
Topic archived. No new replies allowed.