帮我查C语言的错误

#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 ;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2007-03-22
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
}
第2个回答  2007-03-22
#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);
}
第3个回答  2007-03-22
呵呵,你的程序犯了c语言的大忌了,函数不能够嵌套定义
,还有你的数据类型用的非常混乱,建议多读书
下面给你按照你的思路的正确程序,好好改正一下错误,呵呵 努力吧
#include<stdio.h>
int prodct(int a,int b)
{
int c;
c=a*b;
return(c);
}
main()
{
int x,y,p;
scanf("%d,%d",&x,&y);
p=prodct(x,y);
printf("The product is %d\n",p);

}
第4个回答  2007-03-22
同爱吃红烧肉的答案一致.
相似回答