Pascal保留字

PASCAL保留字2007-11-14 23:10PASCAL中,保留字分为6种共36个:
(1)程序、函数、过程符号
program,function,procedure
(2)说明部分专用定义符号
array,const,file,label,of packed,record,set,type,var
(3)语句专用符号
case,do,downto,else,for,forward,goto,if,repeat,then,to until,while,with
(4)运算符号
and,div,in,mod ,not,or
(5)分隔符号
begin,end
(6)空指针常量
nil

标识符分为两大类:
(1)标准标识符(pascal中可直接使用)
标准常量:false,true,maxint.
标准类型:integer,real,char,boolean,text
标准文件:input,output
标准函数:abs绝对值,arctan反正切函数,chr字符,cos余弦,eof不清楚,eoln不清楚,exp指数,ln对数,odd奇数函数,ord序数,pred前趋,sin不用说吧这个,sqr平方,sqrt算术平方根,succ后继,trunc截尾
标准过程:get,new,pack,page,put,read,readln,reset,rewrite,unpack,write,writeln
(2)自定义标识符
自定义标识符是用户按标识符定义的规则自己定义的。

(费了n久,打了上面这些常用的。谢谢也要说声啊)

-----------------------------意思及用法下面咯
简单的:::
1、 程序、函数、过程的符号:

(1)program 程序

(2)function 函数

(3)procedure 过程

2、 说明部分的专用定义符号

(4)array 定义数组

例如:type data=array[1..100] of integer;

(5)const 常量说明

例如:const pi=3.1415926;

(6)file 文件类型

例如:type text=file of char;

(7)lable 标号说明

格式:lable 标号1,标号2,……;

(8)packed 指令(记录)

(9)var 变量说明

例如:var a,b,c:integer;

(10)record 记录类型

例如:type studata=record

age:integer;

sex:char;

chinese:real;

maths:real;

english:real;

end;

(11)set 集合类型

例如:type num1=set of 1..10;

(12)type 类型说明

例如:定义“daytype”表示有关日期的数据类型名:

type daytype=(sun,min,tue,wed,thu dri,sat);

(13)of (见case、array、set、file)

3、语句专用符号

(14)case 分情况语句

格式:case 表达式 of
常数表1:语句1;
常数表2:语句2;
……
常数表n:语句n;
else 语句 n+1
end

(15)do (见for、while)

(16)downto (见for)

(17)else (见if、case)

(18)for 计数循环语句

格式1:for控制变量:=初值 to 终值 do

循环体语句;

格式2:for控制变量:=初值 downto 终值 do

循环体语句;

在for语句中如果使用to,称为递增型计数循环语句;使用downto,称为递减型计数循环语句。

(19)goto 语句

例如:goto 标号

程序不继续执行下一条语句,而转向标号所指的语句执行。

(20)if 条件语句

格式1:if 条件 then语

句1;

格式2:if 条件 then语句1 else语句2;

(21)repeat 直到型循环语句

格式:repeat

语句1;

语句2;

语句3;



语句n

until 布尔表达式

(22)then (见if)

(23)to (见for)

(24)until (见repeat)

(25)while 当循环语句

格式:While布尔表达式do 语句;

(26)with 语句

(27)forward 函数指令

4、运算符号

(28)and 与

(29)div 整除

(30)in 集体运算符,判断一个元素是否在集合中

(31)mod 求余

(32)not 非

(33)or 或

5、分隔符号

(34)begin 块标记,开始

(35)end 块标记,结束

6、空指针符号

(36)nil 空指针

相关主题
相关文档
最新文档