首页 > 试题广场 >

Indiana Sloth已经编好了下面的程序,并想征求你的

[问答题]
Indiana Sloth已经编好了下面的程序,并想征求你的意见。请帮助他评定。
include studio.h
int main{void}/*该程序可显示出一年中有多少周/*
(
int s
s: = 56;
print (There are s weeks in a year.);
return 0;

推荐
第一行:以一个#开始,拼写出文件名stdio.h,然后把文件名放在一对尖括号中。
第二行:使用(),而不是{};使用*/来结束注释,而不是使用/*。
第三行:使用{,而不是(。
第四行:使用分号来结束语句。
第五行:Indiana使这一行(空白行)正确!
第六行:使用=,而不是:=进行赋值(显然,Indiana了解一些Pascal)。每年有52周而不是56周。
第七行:应该是:
printf ("There are %d weeks in a year.\n",s);
第九行:原程序没有第九行,但是应该有,它应该包含一个结束花括号}。在进行这些修改之后,代码如下:
#include <stdio.h>
int main (void) /* this prints the number of weeks in a year */
{
int s;
s = 52;
printf ("There are %d weeks in a year.\n",s);
return 0;
}
发表于 2018-05-05 21:21:19 回复(1)
include <studio.h>
int main(void)/*该程序可显示出一年中有多少周/*
{
int s;
s = 56;
print("There are %d weeks in a year.",s);
}

发表于 2020-06-30 14:23:04 回复(1)