老师第一节课教的,为什么运行不了
#include <stdio.h>#include <math.h>
void main()
{
double x, s;
printf("input number:\n");
scanf("%lf",&x);
s=sin(x);
printf("sin of %lf is %lf\n",x,s);
} 本帖最后由 昨非 于 2020-8-29 18:11 编辑
首行加上
#define _CRT_SECURE_NO_WARNINGS
试试 #include <stdio.h>
#include <math.h>
int main(void)
{
double x, s;
printf("input number:\n");
scanf("%lf",&x);
s=sin(x);
printf("sin of %lf is %lf\n",x,s);
return 0 ;
} 你不截图,我不信 你编译的时候用
gcc 文件名 -o 文件名 -lmath
试试 你确定文件后缀名是.c吗,在dev-c++中,当你文件后缀名是.cpp,会导致用void定义main的无法运行,你改成int main()或者改后缀名就好了
页:
[1]