请问一下,我VC编译之后出现这个问题该咋办...求大佬解答感激不尽!
--------------------Configuration: dadada - Win32 Debug--------------------Compiling...
dadadada.c
d:\dacan\dadada\dadadada.c(4) : error C2018: unknown character '0xa3'
d:\dacan\dadada\dadadada.c(4) : error C2018: unknown character '0xa8'
d:\dacan\dadada\dadadada.c(4) : error C2018: unknown character '0xa3'
d:\dacan\dadada\dadadada.c(4) : error C2018: unknown character '0xa9'
d:\dacan\dadada\dadadada.c(5) : error C2182: 'main' : illegal use of type 'void'
d:\dacan\dadada\dadadada.c(5) : error C2054: expected '(' to follow 'main'
d:\dacan\dadada\dadadada.c(8) : error C2018: unknown character '0xa3'
d:\dacan\dadada\dadadada.c(8) : error C2018: unknown character '0xbb'
执行 cl.exe 时出错.
dadadada.obj - 1 error(s), 0 warning(s)
main()函数改用int申明,在结尾加上return 0;试试,还有报错就把新的发上来,最好是可以连同所有代码一起发上来。 : unknown character '0xa3'
'0xa3'未知的char类型 xhzzzloveyou 发表于 2018-8-15 08:00
main()函数改用int申明,在结尾加上return 0;试试,还有报错就把新的发上来,最好是可以连同所有代码一起发 ...
这个是原来的
#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: 1111 - Win32 Debug--------------------
Compiling...
111.c
d:\dacan\1111\111.c(4) : error C2018: unknown character '0xa3'
d:\dacan\1111\111.c(4) : error C2018: unknown character '0xa8'
d:\dacan\1111\111.c(4) : error C2018: unknown character '0xa3'
d:\dacan\1111\111.c(4) : error C2018: unknown character '0xa9'
d:\dacan\1111\111.c(5) : error C2182: 'main' : illegal use of type 'void'
d:\dacan\1111\111.c(5) : error C2054: expected '(' to follow 'main'
d:\dacan\1111\111.c(8) : error C2018: unknown character '0xa3'
d:\dacan\1111\111.c(8) : error C2018: unknown character '0xbb'
执行 cl.exe 时出错.
111.obj - 1 error(s), 0 warning(s) C99 标准后就没有void mai(),改为int main(),再在末尾加上return 0试试,还有 scanf("%lf", %x); 中应改为&x 和楼上说的差不多,x前面用的是取地址符,main函数要用int定义,而且你有的地方用了中文符号。
以下是我改过的,你试试看能不能编译。
#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;
} xhzzzloveyou 发表于 2018-8-15 21:43
和楼上说的差不多,x前面用的是取地址符,main函数要用int定义,而且你有的地方用了中文符号。
以下是我改 ...
可以了谢谢大佬{:5_109:} 初代幻冰 发表于 2018-8-15 14:45
C99 标准后就没有void mai(),改为int main(),再在末尾加上return 0试试,还有 scanf("%lf", %x); 中应改 ...
谢谢老哥{:5_106:}
页:
[1]