Sign in Join
Wiki copytemporary

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

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

OldNewLine
111H - 编程作业 (原作者: Tao Yue, 状态: 未更改)
22
33你学会了如何定义变量和改变它们的值。现在,开始做你的第一个作业吧?
44
55不过,有个小问题:你还不知道如何将数据显示在屏幕上。
66
77所以,在开始之前,下面的代码将用来显示数据,并在以后的作业中使用到:
88
99``` pascal
1010writeln (参数列表);
1111```
1212
1313参数列表是由字符串或以逗号分隔的变量名来组成,如:
1414
1515``` pascal
1616writeln ('Sum = ', sum);
1717```
1818
1919编程作业:
2020
2121在45、68、2、34,这5个整数中,求出它们的平均值、总和。 (求和运算,结果类型应该为整数型;求平均值是实数型。)
2222
2323使用常量存储该程序处理整数的数目,即定义一个常量,值为5。
2424
2525然后显示它,显示应该是这个样子:
2626
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`\
27+```
28+Number of integers = 5
29+Number1 = 45
30+Number2 = 7
31+Number3 = 68
32+Number4 = 2
33+Number5 = 34
34+Sum = 156
35+Average = 3.1200000000E+01
36+```
3537
3638正如你看到的,实数默认以科学记数法方式显示。
3739
3840第2章将解释如何格式化为小数。
3941
4042解决方法?下一页会看到。
4143
4244| | | |
4345|----|----|----|
4446| [[Basic Pascal Tutorial/Chapter 1/Punctuation and Indentation/zh CN|上一页]] | [[Basic Pascal Tutorial/Contents/zh CN|目录]] | [[Basic Pascal Tutorial/Chapter 1/Solution/zh CN|下一页]] |
4547
4648---
4749*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