卡卡qqq 发表于 2020-2-25 19:16:49

怎么没办法运行

#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);
}

卡卡qqq 发表于 2020-2-25 19:17:58

--------------------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)

人造人 发表于 2020-2-25 19:24:26

仔细检查你的代码,尤其是标点符号

zltzlt 发表于 2020-2-25 19:31:16

第 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]
查看完整版本: 怎么没办法运行