次のコードの両方の関数で次のエラーが発生しています。
In function 'Celsius_Converter':
Line 64: error: called object '0' is not a function
In function 'Fahrenheit_Converter':
Line 90: error: called object '1' is not a function
これが私のコードです:
/*
*Program Name: COP 2220-10018 Project 3
*
* Author: Nathan Gamble
*
* Description: Convert either Celsius to Fahrenheit, or Fahrenheit to Celsius.
*
* Input: Celsius or Fahrenheit Temperature
*
* Output: Fahrenheit or Celsius, depending on which one the User requested.
*/
#include <stdio.h>
#include <math.h>
int main (void)
{
//Local Declarations
char choice;
int fahrenheit;
int celsius;
//Statements
printf("This program converts Celsius temperature to Fahrenheit degree and Fahrenheit temperature to Celsius degree. \n");
printf("If you want to convert Celsius to Fahrenheit, please enter C.");
printf("If you want to convert Fahrenheit to Celsius, please enter F.");
scanf("%s", &choice);
//Process
if (choice == 'C') {
fahrenheit = Celsius_Converter();
printf("The temperature in Fahrenheit degree is %d", &fahrenheit);
}
else {
celsius = Fahreinheit_Converter();
printf("The temperature in Celsius degree is %d", &celsius);
}
return 0;
} // End main
/*
*Program Name: COP 2220-10018 Project 3
*
* Author: Nathan Gamble
*
* Description: Convert Celsius to Fahrenheit
*
* Input: Celsius Temperature
*
* Output: Fahrenheit
*/
int Celsius_Converter ()
{
//Local Declarations
double fahrenheit;
double celsius;
printf("Enter a temperature in Celsius.");
scanf("%d", &fahrenheit);
celsius = (5/9) (&fahrenheit - 32);
return celsius;
} //end Celsius_Converter
/*
*Program Name: COP 2220-10018 Project 3
*
* Author: Nathan Gamble
*
* Description: Convert Fahrenheit to Celsius
*
* Input: Fahrenheit Temperature
*
* Output: Celsius
*/
int Fahrenheit_Converter ()
{
//Local Declarations
double fahrenheit;
double celsius;
printf("Enter a temperature in Fahrenheit.");
scanf("%d", &celsius);
fahrenheit = (9/5) (&celsius + 32);
return fahrenheit;
} //end Fahrenheit_Converter