Re: [Dev-C++] Problem compiling a simple student grading program
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Per W. <pw...@ia...> - 2009-04-14 11:02:10
|
Make sure the compiler knows that you have multiple grade() functions before you make the call. At the point of error, the compiler only knows about the grade function that takes a reference to a struct, and it see you send three floating-point numbers. That makes the compiler unhappy. With function prototypes before the call, the compiler will know which grade() function to use. /pwm On Mon, 13 Apr 2009, Chedtha Intaravitak wrote: > Hi > > I tried to complie an attached source code for a simple student grading > program with Dev C++. > > > The error I got was with the following lines of code: > double grade(const Student_info& s) > { > return grade(s.midterm, s.final, s.homework); > } > > The error said: > > 47 C:\Users\chedtha\Documents\Accelerated C++\students_grade4.cpp "invalid > initialization of reference of type 'const Student_info&' from expression of > type 'const double'" > > > What does it mean? And what should I do? > > Thanks > Chedtha > |