新建控制台程序: File--> New -->Other --> console Application
1 program Project1; 2 3 {$APPTYPE CONSOLE} 4 5 uses 6 SysUtils; 7 var 8 a,b,sum:Integer; 9 10 procedure jiujiuTable(); 11 var 12 i,j:Integer; 13 begin 14 for i:=1 to 9 do 15 begin 16 for j:=1 to i do 17 write(j:3,‘*‘,i,‘=‘,i*j:2); 18 Writeln; 19 end; 20 end; 21 22 function add(a,b:Integer):Integer; 23 begin 24 Result:=a+b; 25 end; 26 27 28 29 begin 30 write(‘输入a: ‘); 31 Readln(a); 32 write(‘输入b: ‘); 33 Readln(b); 34 sum:=add(a,b); 35 Writeln(‘a+b=‘,sum); 36 37 Writeln(‘九九乘法表:‘); 38 jiujiuTable(); 39 Readln; //等待输入,用户输入字符后按回车将会退出(如果没有这个函数,上面那句在屏幕输出字符后一闪就退出了) 40 41 end.
运行效果:
时间: 2024-11-08 13:57:55