Sign in Join
Wiki copytemporary

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.

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-```
27+```text
2828Number of integers = 5
2929Number1 = 45
3030Number2 = 7
3131Number3 = 68
3232Number4 = 2
3333Number5 = 34
3434Sum = 156
3535Average = 3.1200000000E+01
3636```
3737
3838正如你看到的,实数默认以科学记数法方式显示。
3939
4040第2章将解释如何格式化为小数。
4141
4242解决方法?下一页会看到。
4343
4444| | | |
4545|----|----|----|
4646| [[Basic Pascal Tutorial/Chapter 1/Punctuation and Indentation/zh CN|上一页]] | [[Basic Pascal Tutorial/Contents/zh CN|目录]] | [[Basic Pascal Tutorial/Chapter 1/Solution/zh CN|下一页]] |
4747
4848---
4949*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