When I build the following I get an error as follows:
'float computedecimal' redeclared as different kind of symbol
Previous declaration of 'float computedecimal (int, int, int)'
I don't understand this as I am passing 3 ints to the function and expecting a float in return.Code:#include <iostream> using namespace std; int degrees {}; int minutes {}; int seconds {}; float decimal{}; const int secondsinminute {60}; const int minutesindegree {60}; float computedecimal (int, int, int); int main() { cout<<"Please insert degrees : "; cin>> degrees; cout<<endl<<endl<<"Please insert minutes : "; cin>>minutes; cout<<endl<<endl<<"Please insert seconds : "; cin>>seconds; decimal=computedecimal (degrees, minutes, seconds); cout<<endl<<endl<<degrees<<" degrees, "<<minutes<<" minutes, "<<seconds<<" seconds = " <<decimal<<" degrees"; cin.get (); cin.get (); return 0; } float computedecimal (degrees, minutes, seconds) { int top=(minutes*secondsinminutes)+seconds; int bottom=secondsinminutes*minutesindegree; decimal=degrees+(top/bottom); return decimal; }
Obviously I am doing something wrong but can't figure it out myself.



1Likes
LinkBack URL
About LinkBacks



