我知道温度计的问题已经死了,但我想我会试一试。
我不断收到错误消息“使用未声明的标识符'converterc'”和“使用未声明的标识符'converterf'”。有任何想法吗?
长钉
#include <iostream>
#include "converters.h"
using namespace std;
int main()
{
int degree;
int weehoo;
cout<<"\n\n\n\t\t Enter the temperature : ";
cin>>degree;
cout<<"\n\n\t\t If the temperature is in Celsius enter 0, if Farenheit enter 1 :";
cin>>weehoo;
if (weehoo==0)
{
cout<<"\n\n\t\tThe temperature in Farenheit is "<<converterc(degree,weehoo)<<endl;
}
else
{
cout<<"\n\n\t\tThe temperature in Celsius is "<<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);
};
转换器.cpp 文件#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;
}