【发布时间】:2016-01-03 23:55:40
【问题描述】:
所以我正在制作一个制作表格的函数,它将 x 和 y 值放在一个方程中。这是我目前所拥有的。
#include <stdio.h>
#include <math.h>
int main(){
int x, y;
float num;
printf("%3c", '+');
for (x=5; x <= 100;x=x+5){
printf("%8i",x);
}
printf("\n");
for (y = 5; y<= 100;y=y+5){
printf("%3d ",y);
for (x=5;x<=100;x=x+5){
num = theMath(x, y);
printf("%7f", num);
printf(" ");
}
printf("\n");
}
return 0;
}
float theMath(int x, int y){
float sum;
sum = ((x*x*x*x)/(y*y)) + sqrt(y);
return sum;
}
它告诉我“错误:'theMath' 的类型冲突”,我不知道为什么。用 gcc 编译。
【问题讨论】:
-
你是怎么编译这个的?
-
我正在用 gcc 编译
-
你能粘贴 gcc 行吗(即
gcc test.c -lm -o test.o)? -
gcc xtable.c -o xtable -lm
标签: c function types floating-point