嗨伙计们〜我想知道为什么这个简单的代码错误!! [英] Hi guys~ i wonder that why this simple code error!!
问题描述
#include< stdio.h>
#include< stdlib.h>
int main(无效)
{
int a,b;
float result = 0.0f;
char symbol =''\ 0 '';
int loop = 0;
printf(" ****************** ************* \ n");
printf(这是计算器程序\ n);
Printf(请输入第一个号码:\ n);
scanf("%f",& a);
printf(" Please ,输入第二个数字:\ n");
scanf("%f",& b);
printf(" Please,选择菜单( +, - ,*,/,%。\ n");
scanf("%c",& symbol);
printf(" * ******************************** \ n");
做{
if(symbol ==''+'')
result = a + b;
else if(symbol ==' '*'')
result = a * b;
else if(symbol ==''/'')
if(b == 0)
{
printf("错误!!,你重新插入第二个值\ n");
loop = 1;
}
result = a / b;
if(symbol ==''%'')
if(b == 0)
{
printf("错误! !,你重新插入第二个
值\ n");
loop = 1;
}
结果= a%b;
} while(循环);
printf("结果:%d%c%d =%f \ n",a,符号,b,
结果);
系统(PAUSE);
返回0;
}
错误信息是printf未声明。(首先使用此功能)
为什么?
问题。写道:
Printf(" Please,Enter first Number:\ n");
这是真的未申报))
-
s /.../。gotovchits / g for电子邮件。
9月19日下午1点45分,问题。 < kjy1 ... @ icu.ac.krwrote:
Printf(" Please,Enter first Number:\ n");
P in caps。 C区分大小写。我认为这是导致错误的。
问候,
Prayag Narula
"问题" < kj ***** @ icu.ac.krwrote:
#include< stdio.h>
printf(" ************************** ***** \ n");
printf(这是计算器程序\ n);
Printf(" Please,Enter first编号:\ n");
错误信息是printf未声明。(首先使用此功能)
不,这不是。如果您不想被
注意阅读错误消息,那么您就不适合成为程序员。
Richard
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int a, b;
float result = 0.0f;
char symbol = ''\0'';
int loop = 0;
printf("*******************************\n");
printf("This is the Calculator Program\n");
Printf("Please, Enter first Number : \n");
scanf("%f", &a);
printf("Please, Enter second Number : \n");
scanf("%f", &b);
printf("Please, Select the menu (+, -, *, /, % .\n");
scanf("%c", &symbol);
printf("*********************************\n");
do{
if (symbol == ''+'')
result = a + b;
else if (symbol == ''*'')
result = a * b;
else if (symbol == ''/'')
if (b == 0)
{
printf("Error!!, You reinsert second value\n");
loop = 1;
}
result = a/b;
if (symbol == ''%'')
if (b == 0)
{
printf("Error!!, You reinsert second
value\n");
loop = 1;
}
result = a % b;
}while(loop);
printf("Result : %d %c %d = %f\n", a, symbol, b,
result);
system("PAUSE");
return 0;
}
the error message is printf is undeclared.(first use this function)
why?
problem. wrote:
Printf("Please, Enter first Number : \n");It is really undeclared ))
--
s/.../.gotovchits/g for email.
On Sep 19, 1:45 pm, "problem." <kjy1...@icu.ac.krwrote:
Printf("Please, Enter first Number : \n");P in caps. C is case-sensitive. I think this is causing the error.
Regards,
Prayag Narula
"problem." <kj*****@icu.ac.krwrote:
#include <stdio.h>
printf("*******************************\n");
printf("This is the Calculator Program\n");
Printf("Please, Enter first Number : \n");
the error message is printf is undeclared.(first use this function)No, it isn''t. If you cannot be bothered to read your error messages with
attention, you are not fit to be a programmer.
Richard
这篇关于嗨伙计们〜我想知道为什么这个简单的代码错误!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!