May 8, 2013 at 6:08pm UTC
Here is my problem.
'void binary_tree::insert(int,int,char,char [],char [])' : cannot convert parameter 3 from 'const char [11]' to 'char'
The main function(part that have error)
1 2 3 4 5 6 7 8 9 10
void header(int n);
int main()
{
header(2);
binary_tree insert;
insert.insert(342344, 89,"Binary Problem" ,"Kenan" , "Roge" );
insert.insert(23434234, 78,"Cyber World" ,"Ann" , "Sofie" );
insert.menu();
return 0;
}
Last edited on May 8, 2013 at 7:35pm UTC
May 8, 2013 at 6:16pm UTC
You cannot convert "Binary Problem" to char student_course.
student_course is a single character and "Binary Problem" is a pointer to a char.
Try char [] student_course
instead of char student_course
.
May 8, 2013 at 6:20pm UTC
its like this char student_course[30]?
May 8, 2013 at 6:35pm UTC
Did you alter your class declaration as well? Please show us the complete code.
May 8, 2013 at 6:37pm UTC
void binary_tree::insert(int student_id, int grade, char student_course[50], char first[100], char last[100])
{
if(root!=NULL)
insert(student_id,grade,student_course,first,last,root);
else
{
root=new record;
root->student_id=student_id;
root->grade=grade;
root->student_course=student_course;
strcpy(root->student_name,first);
strcat(root->student_name,last);
root->left=NULL;
root->right=NULL;
}
}
Last edited on May 8, 2013 at 7:31pm UTC
May 8, 2013 at 6:56pm UTC
In function binary_tree::insert() try
strcpy(root->student_course,student_course);
instead of
root->student_course=student_course;
And don't forget to free resources:
1 2 3 4 5
binary_tree::binary_tree()
{
if (root)
delete root;
}
Last edited on May 8, 2013 at 7:02pm UTC