C++ 获取错误:";错误:‘;的类型冲突;呼叫"摄氏&"x2019 ;&引用;及;注:先前的隐含声明‘;呼叫"摄氏&"x2019 ;;“在这里”;
我无法在gcc中编译此代码。我试着把call_Celsiu改为计算,也试着把它从大写改为小写。我不确定这是因为我没有声明一个我认为不正确的变量,还是因为我调用的函数错误C++ 获取错误:";错误:‘;的类型冲突;呼叫"摄氏&"x2019 ;&引用;及;注:先前的隐含声明‘;呼叫"摄氏&"x2019 ;;“在这里”;,c++,c,opengl,C++,C,Opengl,我无法在gcc中编译此代码。我试着把call_Celsiu改为计算,也试着把它从大写改为小写。我不确定这是因为我没有声明一个我认为不正确的变量,还是因为我调用的函数错误 /* Homework 1 Question 2 */ /* Purpose: Takes a depth (in kilometers) inside the earth */ /* as input data; Computes and displays the temperature at */ /* depth in
/* Homework 1 Question 2 */
/* Purpose: Takes a depth (in kilometers) inside the earth */
/* as input data; Computes and displays the temperature at */
/* depth in degrees Celsius and degrees Fahrenheit. */
#include <stdio.h>
int main(void)
{
/* Declare Variables */
double depth;
double Celsius;
double Fahrenheit;
/* Obtain Data */
printf("Please enter depth(in kilometers) inside the Earth: ");
scanf("%lf",&depth);
/* Calculate */
Celsius = call_celsius(depth);
Fahrenheit = call_fahrenheit(Fahrenheit);
/* Output */
printf("The temperature at %lf kilometers is %lf degrees Celsius and %lf degrees Fahrenheit",depth, Celsius, Fahrenheit);
return 0;
}
double call_celsius(double depth)
{
return((10 * depth) + 20);
}
double call_fahrenheit(double Celsius)
{
return((1.8 * Celsius) + 32);
}
在使用它们之前,您没有声明
调用摄氏度
和调用华氏度
。添加函数原型或声明并定义函数。以下是转发声明的示例:
double call_celsius(double depth);
double call_fahrenheit(double Celsius);
int main(void) {
呜呜!非常感谢。不知道您也需要声明这些变量…实际上不知道它们是自己的变量。谢谢你的帮助。编译并运行顺利。:)
double call_celsius(double depth);
double call_fahrenheit(double Celsius);
int main(void) {