Basic Pascal Tutorial/Chapter 1/Programming Assignment/zh CN: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | 1H - 编程作业 (原作者: Tao Yue, 状态: 未更改) | |
| 2 | 2 | ||
| 3 | 3 | 你学会了如何定义变量和改变它们的值。现在,开始做你的第一个作业吧? | |
| 4 | 4 | ||
| 5 | 5 | 不过,有个小问题:你还不知道如何将数据显示在屏幕上。 | |
| 6 | 6 | ||
| 7 | 7 | 所以,在开始之前,下面的代码将用来显示数据,并在以后的作业中使用到: | |
| 8 | 8 | ||
| 9 | 9 | ``` pascal | |
| 10 | 10 | writeln (参数列表); | |
| 11 | 11 | ``` | |
| 12 | 12 | ||
| 13 | 13 | 参数列表是由字符串或以逗号分隔的变量名来组成,如: | |
| 14 | 14 | ||
| 15 | 15 | ``` pascal | |
| 16 | 16 | writeln ('Sum = ', sum); | |
| 17 | 17 | ``` | |
| 18 | 18 | ||
| 19 | 19 | 编程作业: | |
| 20 | 20 | ||
| 21 | 21 | 在45、68、2、34,这5个整数中,求出它们的平均值、总和。 (求和运算,结果类型应该为整数型;求平均值是实数型。) | |
| 22 | 22 | ||
| 23 | 23 | 使用常量存储该程序处理整数的数目,即定义一个常量,值为5。 | |
| 24 | 24 | ||
| 25 | 25 | 然后显示它,显示应该是这个样子: | |
| 26 | 26 | ||
| 27 | - | ||
| 27 | + | ```text | |
| 28 | 28 | Number of integers = 5 | |
| 29 | 29 | Number1 = 45 | |
| 30 | 30 | Number2 = 7 | |
| 31 | 31 | Number3 = 68 | |
| 32 | 32 | Number4 = 2 | |
| 33 | 33 | Number5 = 34 | |
| 34 | 34 | Sum = 156 | |
| 35 | 35 | Average = 3.1200000000E+01 | |
| 36 | 36 | ``` | |
| 37 | 37 | ||
| 38 | 38 | 正如你看到的,实数默认以科学记数法方式显示。 | |
| 39 | 39 | ||
| 40 | 40 | 第2章将解释如何格式化为小数。 | |
| 41 | 41 | ||
| 42 | 42 | 解决方法?下一页会看到。 | |
| 43 | 43 | ||
| 44 | 44 | | | | | | |
| 45 | 45 | |----|----|----| | |
| 46 | 46 | | [[Basic Pascal Tutorial/Chapter 1/Punctuation and Indentation/zh CN|上一页]] | [[Basic Pascal Tutorial/Contents/zh CN|目录]] | [[Basic Pascal Tutorial/Chapter 1/Solution/zh CN|下一页]] | | |
| 47 | 47 | ||
| 48 | 48 | --- | |
| 49 | 49 | *From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 1/Programming Assignment/zh CN", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
