首页上一页 1 下一页尾页 1 条记录 1/1页
从入门到精通,第二版,9页
发表在C语言图书答疑
2013-06-14
是否精华
是
否
版块置顶:
是
否
[img src=null/img]
#include<stdio.h>
#define Height 10
int calculate(int Long,int Width)
int main()
{ int m_Long;
int m_width;
int result;
printf("长方体的高度为:%d\n",Height);
printf("请输入长度\n");
scanf("%d",&m_Long);
printf("请输入宽度\n");
scanf("%d",&m_Width");
result=calculate(m_Long,m_Width);
printf("长方体的体积是:");
printf("%d\n",result);
return 0;
}
int calculate(int Long,int Width)
{
int result=Long*Width*Height;
return result;
}
报错:
E:\1.c(5) : error C2085: 'main' : not in formal parameter list
E:\1.c(5) : error C2143: syntax error : missing ';' before '{'
E:\1.c(15) : error C2001: newline in constant
E:\1.c(15) : error C2065: 'm_Width' : undeclared identifier
E:\1.c(15) : error C2143: syntax error : missing ')' before 'string'
E:\1.c(24) : error C2084: function 'int __cdecl calculate(int ,int )' already has a body
执行 cl.exe 时出错.
1.exe - 1 error(s), 0 warning(s)
#include<stdio.h>
#define Height 10
int calculate(int Long,int Width)
int main()
{ int m_Long;
int m_width;
int result;
printf("长方体的高度为:%d\n",Height);
printf("请输入长度\n");
scanf("%d",&m_Long);
printf("请输入宽度\n");
scanf("%d",&m_Width");
result=calculate(m_Long,m_Width);
printf("长方体的体积是:");
printf("%d\n",result);
return 0;
}
int calculate(int Long,int Width)
{
int result=Long*Width*Height;
return result;
}
报错:
E:\1.c(5) : error C2085: 'main' : not in formal parameter list
E:\1.c(5) : error C2143: syntax error : missing ';' before '{'
E:\1.c(15) : error C2001: newline in constant
E:\1.c(15) : error C2065: 'm_Width' : undeclared identifier
E:\1.c(15) : error C2143: syntax error : missing ')' before 'string'
E:\1.c(24) : error C2084: function 'int __cdecl calculate(int ,int )' already has a body
执行 cl.exe 时出错.
1.exe - 1 error(s), 0 warning(s)