hello everyone. im new to the forums and i dont really know how to use tags(sorry about that, administrator). anyway i have a really annoying problem when i try to compile this using Borland- i get like 6 error all saying "type mismatch in parameter..." and "cannot convert int to const char". I'd appreciate some help. Thanks
Code:
#include<iostream>
#include<conio>
#include<stdio>
#include<string>
class tourist{
private:
char namet[5];
char tot[5];
char fromt[5];
char typet;
int ID;
int distance;
int charge;
public:
void getdata(){
cout<<"Enter ID:, then name(separated by enter key)";
cin>>ID;
cin.get(namet,5);
cout<<"\nEnter to/from:(type destination, hit enter, type origin, hit enter)";
cin.getline(tot,5);
cin.get(fromt,5);
cout<<"\nEnter distance:";
cin>>distance;
cout<<"\nEnter type:";
gets(typet);
}
void calccharge(){
if(strcmp(typet,'e'))
charge=distance*30;
else charge=distance*20;
}
void display(){
cout<<"\nDetails are"<<"\t"<<ID<<"\t"<<namet<<"\t"<<typet<<"\t"<<tot<<"\t"<<fromt<<"\t"<<charge;
}
};
void main(){
tourist t1;
cout<<"\n";
t1.getdata();
t1.calccharge();
t1.display();
}
PS the variable names are a bit messed up cause i changed them since i thought i was using a reserved word or something...