帮我查C语言的错误

来源:百度知道 编辑:UC知道 时间:2024/09/28 08:56:25
#include <stdio.h>
main()
{
int x,y;
scanf(“%x,%y”,&x,&y);
p=prodct(x,t)
printf(“The product is :”,p);
int prodct(int a ,int b );
int c ;
c=a*b
return c
}

1,prodct没声明
2,应该用"不能用”
3,注意每个语句末尾的分号
4,输出整形要加%d
#include <stdio.h>
int prodct(int a ,int b );
main()
{
int x,y;
scanf("%x,%y",&x,&y);
p=prodct(x,y)
printf("The product is :%d",p);
}
int prodct(int a ,int b )
{
int c ;
c=a*b ;
return c ;
}

main函数是独立的,prodct是你自编的,也是独立的,两者不能混在一起,我帮你改一下,因为我没TC,也没VC,所以我无法检查对错,你自己查查

#include <stdio.h>
main()
{
int x,y;
scanf(“%x,%y”,&x,&y);
p=prodct(x,t)
printf(“The product is :”,p);
}
int prodct(int a ,int b );
{
int c ;
c=a*b
return c
}

#include <stdio.h>
main()
{
int x,y;
int prodct(int a ,int b ){return a*b;}/*把函数体加个大括号就行了,c没必要用,还有函数定义得放在调用前面*/
scanf(“%x,%y”,&x,&y);
p=prodct(x,t)
printf(“The product is :”,p);
}

呵呵,你的程序犯了c语言的大忌了,函数不能够嵌套定义
,还有你的数据类型用的非常混乱,建议