Tag: 温度

Arduino中的core.a(main.cpp.o)错误是什么?

我在Arduino中编写代码,突然间我收到了这个错误: core.a(main.cpp.o): In function `main’: D:\Personal\Arduino\arduino-1.0.4-windows\arduino- 1.0.4\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to `setup’ D:\Personal\Arduino\arduino-1.0.4-windows\arduino-1.0.4\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to `loop’ 我不知道这意味着什么。 这是我的代码: #ifndef dht_h #define dht_h #if ARDUINO < 100 #include #else #include #endif #define DHT_LIB_VERSION “0.1.05” #define DHTLIB_OK 0 #define DHTLIB_ERROR_CHECKSUM -1 #define DHTLIB_ERROR_TIMEOUT -2 #define DHTLIB_INVALID_VALUE -999 #include #define TIMEOUT 10000 class dht { public: int read22(uint8_t […]

华氏度到摄氏度的程序改进和选择输出

我几天前刚开始用C语言编程,我想改进我的程序,但不知道该怎么做。 该程序是华氏温度到摄氏温度,反之亦然。 我用最简单的方式做到了。 但现在我想这样做,以便我有2个函数c2f和f2c,它们将温度作为参数,当我运行程序时,我想要选择是否要从F转换为C或从C转换为F(类似于TempConverter -f 32这应该只将32转换为摄氏温度,TempConverter -c 100应该将100转换为华氏温度)。 我认为我的函数应该是这样的: float c2f(float c)和float f2c(float f) 但是它究竟是如何做到这一点所以当我运行类似> TempConverter -f 50.0的东西时,我会得到类似这样的东西吗? 10.00°C = 50.00°F #include int main(void) { // Local Declarations float Celsius, Fahrenheit, Fahrenheit_1, Celsius_2; // Statements printf(“Enter the temperature in Fahrenheit: “); scanf(“%f”, &Fahrenheit); printf(“Fahrenheit temperature is: %5.1f F\n\a”, Fahrenheit); Celsius = (100.0 / 180.0) * […]

C温度转换程序保持输出0华氏度到摄氏度

当我尝试将华氏温度转换为摄氏温度时,我在C中的温度转换程序保持输出0。 从Celsius到Fahrenheit的转换似乎工作得很好。 对于函数和部分,我做了完全相同的事情但是第二次转换时我一直得到0。 有人可以帮助我或告诉我我做错了什么? #include //Function Declarations float get_Celsius (float* Celsius); //Gets the Celsius value to be converted. void to_Fahrenheit (float cel); //Converts the Celsius value to Fahrenheit and prints the new value. float get_Fahrenheit (float* Fahrenheit); //Gets the Fahrenheit value to be converted. void to_Celsius (float fah); //Converts the Fahrenheit value to Celsius and […]