那个帮我看下这个到底哪错了

来源:百度知道 编辑:UC知道 时间:2024/05/23 02:16:36
# inclube"math.h"
main()
{ char c1,c2,c3,c4;
int x;
scanf("%d",&x);
c4=x>=0?'+':'-';
x=abs(x);
c3=x%10+48;
x=x/10;
c2=x%10+48;
c1=x/10+48;
printf("%c\n%c\n%c\n%c\n",c4,c1,c2,c3);
}
谢谢
还是不对
TC2.0上的错误提示是
Error: Unknown preprocessor directive: 'inclube'
Dev-C++上面提示是scanf("%d",&x); 这句前面打了个错号

#include <math.h>
#include <stdio.h>

我在VC中测了,正确的。
printf需要库文件的

# inclube"math.h"写错了
应该是#include "math.h"

#include "math.h"
注意拼写错误

#include <stdio.h>
#include <math.h>

dev_c++还要注意main 一定要声明为int

附加一个说明:
似乎如果是库文件 最好还是 用#include <>,这样如果在库文件中找不到,编译器也会从当前目录包含进文件;如果用#include"",那编译器就直接从当前文件目录寻找该文件,找不到就可能报错了。
但是,vxworks除外~~