Dealing with functions and reading char
Hi , i am required to use stupid visual c++. somehow there is a bug with reading strings, and im am not allowed to fix it.
so i have to use char instead . .
this is part of of the codes:
Code:
//function prototypes
char read_course_name(char* course_name);
void main(void)
{
char course_name[80];
read_course_name(course_name);
}
char read_course_name(char* course_name)
{
cout<< setw(50);
cout<<"Course and Subject Entry";
cout<< endl;
cout<< endl;
cout<<"\tCourse ==> ";
cin.getline(course_name, 80);
return course_name;
}
im getting two errors:
error C2440: 'return' : cannot convert from 'char *' to 'char'
error C2664: 'read_course_name' : cannot convert parameter 1 from 'char [80]' to 'char &'
how do i write a function to read an array of characters? the funny thing is ,it ran perfectly using g++ , argghhh :(
Not related to this thread in any way...
Hermit, are you a professional programmer?