Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 1/Programming Assignment/zh CN: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Basic Pascal Tutorial/Chapter 1/Programming Assignment/zh CN

OldNewLine
1+1H - 编程作业 (原作者: Tao Yue, 状态: 未更改)
2+
3+你学会了如何定义变量和改变它们的值。现在,开始做你的第一个作业吧?
4+
5+不过,有个小问题:你还不知道如何将数据显示在屏幕上。
6+
7+所以,在开始之前,下面的代码将用来显示数据,并在以后的作业中使用到:
8+
9+``` pascal
10+writeln (参数列表);
11+```
12+
13+参数列表是由字符串或以逗号分隔的变量名来组成,如:
14+
15+``` pascal
16+writeln ('Sum = ', sum);
17+```
18+
19+编程作业:
20+
21+在45、68、2、34,这5个整数中,求出它们的平均值、总和。 (求和运算,结果类型应该为整数型;求平均值是实数型。)
22+
23+使用常量存储该程序处理整数的数目,即定义一个常量,值为5。
24+
25+然后显示它,显示应该是这个样子:
26+
27+`Number of integers = 5`\
28+`Number1 = 45`\
29+`Number2 = 7`\
30+`Number3 = 68`\
31+`Number4 = 2`\
32+`Number5 = 34`\
33+`Sum = 156`\
34+`Average = 3.1200000000E+01`\
35+
36+正如你看到的,实数默认以科学记数法方式显示。
37+
38+第2章将解释如何格式化为小数。
39+
40+解决方法?下一页会看到。
41+
42+| | | |
43+|----|----|----|
44+| [[Basic Pascal Tutorial/Chapter 1/Punctuation and Indentation/zh CN|上一页]] | [[Basic Pascal Tutorial/Contents/zh CN|目录]] | [[Basic Pascal Tutorial/Chapter 1/Solution/zh CN|下一页]] |
45+
46+---
47+*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).*

Back to history