Basic Pascal Tutorial/Chapter 1/Standard Functions/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/Standard Functions/zh CN
| Old | New | Line | |
|---|---|---|---|
| 1 | + | 1F - 标准函数 (原作者: Tao Yue, 状态: 有更改) | |
| 2 | + | ||
| 3 | + | 你可以使用Pascal提供的标准数学函数,如,求pi的正弦值: | |
| 4 | + | ||
| 5 | + | ``` pascal | |
| 6 | + | value := sin (3.1415926535897932); | |
| 7 | + | ``` | |
| 8 | + | ||
| 9 | + | 请注意,sin 函数的参数是弧度(一圈=2π弧度)而不是角度(一圈=360°角度),所有其他三角函数也是如此。 如果一切顺利,value 应该变为 0。 | |
| 10 | + | ||
| 11 | + | 通过函数名(参数)调用。标准的Pascal函数有: | |
| 12 | + | ||
| 13 | + | | 函数 | 描述 | 参数类型 | 返回类型 | | |
| 14 | + | |--------|------------|------------|--------------| | |
| 15 | + | | abs | 绝对值 | 实型或整型 | 与参数同类型 | | |
| 16 | + | | arctan | 反正切值 | 实型或整型 | 实型 | | |
| 17 | + | | cos | 余弦 | 实型或整型 | 实型 | | |
| 18 | + | | exp | e的次方值 | 实型或整型 | 实型 | | |
| 19 | + | | ln | 自然对数 | 实型或整型 | 实型 | | |
| 20 | + | | round | 四舍五入 | 实型 | 整型 | | |
| 21 | + | | sin | 正弦 | 实型或整型 | 实型 | | |
| 22 | + | | sqr | 平方 | 实型或整型 | 与参数同类型 | | |
| 23 | + | | sqrt | 平方根 | 实型或整型 | 实型 | | |
| 24 | + | | trunc | 舍去法取整 | 实型或整型 | 整型 | | |
| 25 | + | ||
| 26 | + | 对于有序数据类型(整型或字符型),有明显前驱和后继的,你可以使用这些功能: | |
| 27 | + | ||
| 28 | + | | 函数 | 描述 | 参数类型 | 返回类型 | | |
| 29 | + | |------|---------------------------------|--------------|--------------| | |
| 30 | + | | chr | 返回相对应于 ASCII 所指定的字符 | 整型 | 字符型 | | |
| 31 | + | | ord | 返回字符的 ASCII 码值 | 整型或字符型 | 整型 | | |
| 32 | + | | pred | 前驱值 | 整型或字符型 | 与参数同类型 | | |
| 33 | + | | succ | 后继值 | 整型或字符型 | 与参数同类型 | | |
| 34 | + | ||
| 35 | + | 实数型不是有序的数据类型!这是因为,它没有一个明显的前驱和后继。56.0的后继值是?是56.1,56.01,56.001,56.0001? | |
| 36 | + | ||
| 37 | + | 同理,字符型: | |
| 38 | + | ||
| 39 | + | ` 'b'`\ | |
| 40 | + | ` 后继值: 'c'`\ | |
| 41 | + | ` 前驱值: 'a'` | |
| 42 | + | ||
| 43 | + | 以上不是详尽的介绍,Pascal有很多函数,以应对各种需求。查看帮助文档以了解更多。 | |
| 44 | + | ||
| 45 | + | | | | | | |
| 46 | + | |----|----|----| | |
| 47 | + | | [[Basic Pascal Tutorial/Chapter 1/Assignment and Operations/zh CN|上一页]] | [[Basic Pascal Tutorial/Contents/zh CN|目录]] | [[Basic Pascal Tutorial/Chapter 1/Punctuation and Indentation/zh CN|下一页]] | | |
| 48 | + | ||
| 49 | + | --- | |
| 50 | + | *From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 1/Standard Functions/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).* |
