请问visual stdio 2017的代码与Dev通用吗?
还有能解决一下这个错诶吗#include<stdio.h>
#define Height 10
int culate(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 caluculate(int Long,int Width)
{
int result=Long*Width*Height;
return result;
}
下面提示这样的错误
C:\Users\ASUS\Desktop\c1\计算长方体体积.c In function 'main':
16 14 C:\Users\ASUS\Desktop\c1\计算长方体体积.c 'm_Width' undeclared (first use in this function)
16 14 C:\Users\ASUS\Desktop\c1\计算长方体体积.c each undeclared identifier is reported only once for each function it appears in
求解谢谢!{:5_109:}
好好检查一下代码大小写→_→ bin554385863 发表于 2019-10-20 09:14
好好检查一下代码大小写→_→
对着打,没有错,就是搞不懂哪里出错
本帖最后由 bin554385863 于 2019-10-20 10:10 编辑
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;
'm_Width' undeclared (first use in this function)
百度翻译一下不难吧!
m_Width未定义(在此函数中首次使用)
出错的行号都给出来了→_→
bin554385863 发表于 2019-10-20 10:08
int main()
{
int m_Long;
好吧,我还是不够细心,谢谢啊! .央. 发表于 2019-10-20 17:40
好吧,我还是不够细心,谢谢啊!
正常,刚开始这种错误我也经常犯,比如main写成mian, int写成inf.....
页:
[1]