i know thermometer problems have been done death thought give shot.
i keep getting error messages "use of undeclared identifier 'converterc'" , "use of undeclared identifier 'converterf'". ideas?
spike
#include <iostream> #include "converters.h" using namespace std; int main() { int degree; int weehoo; cout<<"\n\n\n\t\t enter temperature : "; cin>>degree; cout<<"\n\n\t\t if temperature in celsius enter 0, if farenheit enter 1 :"; cin>>weehoo; if (weehoo==0) { cout<<"\n\n\t\tthe temperature in farenheit "<<converterc(degree,weehoo)<<endl; } else { cout<<"\n\n\t\tthe temperature in celsius "<<converterf(degree,weehoo)<<endl; } return 0; } #ifndef __again_converters_h #define __again_converters_h #endif #pragma once class thermometer { private: float degreec; //celcius float degreef; //farenheit public: void setcelcius (float c) {degreec=c;} void setfarenheit (float f) {degreef=f;} float getcelcius (void){return degreec;} float getfarenheit (void){return degreef;} thermometer (float degree=0,float f=0, float c=0,float outtemp=0); float converterc(int degree,int weehoo); float converterf(int degree,int weehoo); };
converters.cpp file #include "converters.h"
float thermometer::converterf(int degree,int weehoo) { degreec=((degree-32) * (.5556)); return degreec ; } float thermometer::converterc(int degree,int weehoo) { degreef=((1.8)*degree)+32; return degreef; }
converterc
, converterf
member function of class thermometer
you're calling them without thermometer
instance.
how creating thermometer
instance in main?
thermometer tm; tm.converterc(degree, weehoo);
Comments
Post a Comment