怎么没办法运行
#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);
} --------------------Configuration: hi - Win32 Debug--------------------
Compiling...
hih.c
C:\Microsoft Visual Studio\MyProjects\hi\hih.c(9) : error C2018: unknown character '0xa3'
C:\Microsoft Visual Studio\MyProjects\hi\hih.c(9) : error C2018: unknown character '0xac'
C:\Microsoft Visual Studio\MyProjects\hi\hih.c(9) : error C2296: '&' : illegal, left operand has type 'char '
C:\Microsoft Visual Studio\MyProjects\hi\hih.c(9) : error C2297: '&' : illegal, right operand has type 'double '
C:\Microsoft Visual Studio\MyProjects\hi\hih.c(9) : error C2198: 'scanf' : too few actual parameters
执行 cl.exe 时出错.
hi.exe - 1 error(s), 0 warning(s)
仔细检查你的代码,尤其是标点符号 第 9 行,标点打成中文的了,而且 & 和 x 之间不能有空格。
代码帮你改好了:
#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);
}
页:
[1]