When I compile the code below it generates more than 30 syntax errors. It does not make sense. The problem is probably somewhere in

Patient(string name_of_patient, int age_of_patient, string address_of_pat, double visit_duration_ofp, string ssn_of_patient, Doctor &doc);

but I could not figure out the problem.
I know it is not convenient to post all the code but I think it will be helpful. Alsoi I attached the cpp file
The code is below:

#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;

class Person
{
public:
	Person();
	Person(string name_of_person, int age_of_person, string address_of_person);
	Person(const Person &p);
	~Person();
	string get_name()const;
	string get_address() const;
	int get_age()const ;
	void set_address(string address_ofp);
	void set_name(string name_ofp);
	void set_age(int age_ofp);
	void input(istream &inp);
	void output(ostream &outp);
protected:
	string name;
	string address;
	int age;
};

class Patient: public Person
{
public:
	Patient();
	Patient(string name_of_patient, int age_of_patient, string address_of_pat, double visit_duration_ofp, string ssn_of_patient, Doctor &doc);
	Patient(const Patient &p);
	~Patient();
	double get_visit_duration() const;
	string get_ssn() const;	
	void set_ssn_(string ssn_ofp);
	void set_visit_duration(double visit_duration_ofp);
	
	void setDoctor(Doctor & doc)
	virtual double billing() const;
	void input(istream &inpa);
	void output(ostream &outpa);
	
protected:
	double visit_duration;
	string ssn;
	Doctor doctor;
};
class Doctor: public Person
{
public:
	Doctor();
	Doctor(string name_of_doctor,int age_of_doctor, string add_of_doctor, double hour_fee_of_doc, long reg_number, string specialty);
	Doctor(const Doctor &d);
	~Doctor();
	double get_fee_of_doc() const;
	long get_regnum_of_doc() const;
	string get_spec_of_doc() const;
	void set_spec_of_doc(string specialty);
	void set_fee_of_doc(double hour_fee);
	void set_regnum_of_doc(long reg_num);
	void input(istream &ind);
	void output(ostream &outd);
protected:
	double doctor_hour_fee;
	long doctor_reg_num;
	string spacialty;
};
int main()
{
	Doctor doctor1("ali",21,"deneadres",100,123333,"kalp");	
	//doctor1.input(cin);
	doctor1.output(cout);
	Patient patient1("mustafa",23,"adresim",0.5,23232,doctor1());
	//patient1.input(cin);
	patient1.output(cout);

}
Person::Person()
{
	name  = "No name yet";
	address = "No address yet";
	age = 0;
}
Person::Person(string name_of_person, int age_of_person,string address_of_person)
{
	name = name_of_person;
	age = age_of_person;
	address = address_of_person;
}
Person::Person(const Person &p)
{
	name = p.name;
	age = p.age;
	address = p.address;
}
Person::~Person()
{
}
string Person::get_name() const
{
	return name;
}
string Person::get_address() const
{
	return address;
}
int Person::get_age() const
{
	return age;
}
void Person::set_address(string address_ofp)
{
	address = address_ofp;
}
void Person::set_name(string name_ofp)
{
	name = name_ofp;
}
void Person::set_age(int age_ofp)
{
	age = age_ofp;
}

void Person::input(istream &inp)
{
	cout << "Please enter information of person (name--address--age)" << endl;
	inp >> name >> address >> age;
}
void Person::output(ostream &outp)
{
	outp << "Name:  " << get_name() << "  Address:  " << get_address() << endl <<  "  Age  :  " << get_age() << endl;
}

Patient::Patient():Person(),visit_duration(0.0),ssn("0"),doctor(Doctor())
{

}
Patient::Patient(string name_of_patient, int age_of_patient, string address_of_pat, double visit_duration_ofp, string ssn_of_patient, Doctor & doc):Person(name_of_patient,age_of_patient,address_of_pat),visit_duration(visit_duration_ofp),ssn(ssn_of_patient),doc(doctor)
{
}
Patient::Patient(const Patient &p)
{
	name = p.name;
	age = p.age;
	address = p.address;
	visit_duration = p.visit_duration;
	ssn = p.ssn;
	doctor = doc;
	//set_doc_fee = p.set_doc_fee;
}
Patient::~Patient()
{
}
double Patient::get_visit_duration() const
{
	return visit_duration;
}
string Patient::get_ssn() const
{
	return ssn;
}
void Patient::set_ssn_(string ssn_ofp)
{
	ssn = ssn_ofp;
}

void Patient::set_visit_duration(double visit_duration_ofp)
{
	visit_duration = visit_duration_ofp;
}

void Patient::setDoctor(Doctor &doc)
{
	doctor = doc;
}
double Patient::billing() const
{	
	/*Doctor *docto_try;
	docto_try = new Doctor;*/
	
	return (doctor.get_fee_of_doc()*get_visit_duration());
}

void Patient::input(istream &inpa)
{
	cout << endl;
	cout << "Please enter information of patient(name--address--age--visit duration--ssn)" << endl;
	inpa >> name >> address >> age >> visit_duration >> ssn ;
}

void Patient::output(ostream &outpa)
{
	outpa << "Name of Patient:  " << get_name() << "  Address of Patient:  " << get_address()
		<< endl << "  Age of Patient:  " << get_age() << "  Visit Duration of Patient:  " <<  get_visit_duration() << endl << "  SSN: of Patient  " << get_ssn()
		<< endl << "The amount you have to pay is:  " << Patient::billing() <<endl;
}
//
Doctor::Doctor():Person(),doctor_hour_fee(0.0), doctor_reg_num(0), spacialty("0")
{
}
Doctor::Doctor(string name_of_doctor,int age_of_doctor, string add_of_doctor, double hour_fee_of_doc, long reg_number, string specialty):Person(name_of_doctor,age_of_doctor,add_of_doctor),doctor_hour_fee(hour_fee_of_doc),doctor_reg_num(reg_number),spacialty(specialty)
{
}
Doctor::Doctor(const Doctor &d)
{
	name = d.name;
	age = d.age;
	address = d.address;
	doctor_hour_fee = d.doctor_hour_fee;
	doctor_reg_num = d.doctor_reg_num;
	spacialty = d.spacialty;
}
Doctor::~Doctor()
{
}
double Doctor::get_fee_of_doc()const
{
	return doctor_hour_fee;
}
long Doctor::get_regnum_of_doc() const
{
	return doctor_reg_num;
}

string Doctor::get_spec_of_doc() const
{
	return spacialty;
}

void Doctor::set_spec_of_doc(string specialty)
{
	spacialty = specialty;
}
void Doctor::set_fee_of_doc(double hour_fee)
{
	doctor_hour_fee = hour_fee;
}
void Doctor::set_regnum_of_doc(long reg_num)
{
	doctor_reg_num = reg_num;
}
void Doctor::input(istream &ind)
{
	cout << "Please enter information of doctor  " << endl << " (name--address--age--1 hour fee--registraiton number--specialty) " << endl;
	ind >> name >> address >> age >> doctor_hour_fee >> doctor_reg_num >> spacialty;
}
void Doctor::output(ostream &outd)
{
	outd << "Name of Doctor: " << name << "  Address of Doctor:  " << address << "  Age: not allowed to see " << endl << "  1 Hour fee of doctor: " <<
		doctor_hour_fee << "Registratioon number of doctor: " << doctor_reg_num << endl << "Specialty of doctor:  " << spacialty; 
}

A multitude of errors, mostly caused by trying to write everything in on go.

(a) Patient includes an instance to Doctor. Therefore you must have a declaration of Doctor before Patient is declared. If it was just a reference or pointer you could have used a forward declaration e.g class Doctor; BUT you can't in this instance.

(b) Lots of typos. you use doc to mean doctor etc e.g. in the copy constructor for Patient. You write doctor1() in the main() { } section.

(c) Failure to call the base constructor in derived constructors and in the assignment operator.

(d) Lots of inconsitancy in format/layout which itself is not wrong but makes it difficult to see what is going on. For beginners I would recommend:
(i) Never use using namespace std; (ii) Don't put names of variables within declarations.
(iii) Consistent set/get naming so it is clear
(iv) copy Constructors are build like this e.g.

Doctor::Doctor(const Doctor& A) : Person(A),
  hour_fee(A.hour_fee),reg_num(A.reg_num)
{}

and the assignment operator like this

Doctor&
Doctor::Doctor(const Doctor& A)
{
   if (this!=&A)
     {
         Person::operator=(A);
         hour_fee=A.hour_fee;
         reg_num=A.reg_num;
     }
    return *this;
}

(v) Don't use a general protected, if that is what you have then change your model to a pure virtual inheritance.

(vi) Validate input.

commented: it was very helpful +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.