小编MAN*_*NAL的帖子

请解释这些Pascal代码..?

我想在pascal实验室考试之前了解这些代码,特别是PROCEDURE

PROGRAM vowels; 

USES crt; 

{Program that counts the number of vowels in a sentence} 

CONST space=' '; 
      maxchar=80; 

TYPE vowel=(a,e,i,o,u); 

VAR buffer:ARRAY[1..maxchar] of char; 
    vowelcount:ARRAY[vowel] of integer; 

PROCEDURE initialize; 

VAR ch:vowel; 

BEGIN 
     FOR ch:=a TO u DO 
     BEGIN 
          vowelcount[ch]:=0; 
     END; 
END; 

PROCEDURE textinput; 

VAR index:integer; 

BEGIN 
     writeln('Input a sentence'); 
     FOR index:=1 TO maxchar DO 
         IF eoln THEN buffer[index]:=space 
         ELSE read(buffer[index]); 
         readln; 
END; 

PROCEDURE analysis; 

VAR index:integer; 
    ch:vowel; 

BEGIN 
     index:=1; 
     WHILE index<>maxchar+1 DO 
     BEGIN 
          IF buffer[index] IN ['a','e','i','o','u'] THEN 
          BEGIN …
Run Code Online (Sandbox Code Playgroud)

pascal

0
推荐指数
1
解决办法
1193
查看次数

标签 统计

pascal ×1