这段代码有错误,请帮我解决 [英] This code gave an error please help me fix it
本文介绍了这段代码有错误,请帮我解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
#include stdio.h;
#define LAST 10
int main()
{
int i, sum = 0;
for ( i = 1; i <= LAST; i++ )
{
sum += i;
}
/*-for-*/
printf("sum = %d\n", sum);
return 0;
}
错误消息是:
在这里OP应该发布错误消息
[/编辑]
请帮帮我.
The error message is:
Here OP should post the error message
[/Edit]
Please help me.
Thanks in advance!
推荐答案
尝试在stdio.h
周围加上<"和>":
Try surroundingstdio.h
with ''<'' and ''>'':
#include stdio.h;
成为
#include <stdio.h>
应该可以解决它!
格里夫太近了.
Griff was so close.
#include <stdio.h>// not #include stdio.h; or #include <stdio.h>;
#define LAST 10
int main()
{
int i, sum = 0;
for ( i = 1; i <= LAST; i++ )
{
sum += i;
}
/*-for-*/
printf("sum = %d\n", sum);
return 0;
}//
它在输出中正常工作:sum = 55
It works fine with the output: sum = 55
代码对我来说很好.您从哪里得到错误消息,它是什么错误消息?
Code looks fine to me. Where are you getting the error message, and what error message is it?
这篇关于这段代码有错误,请帮我解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文