てへ、もういっちょ教えてくださいw さっきのを、整数じゃなくて実数にするのですが、 program PR01(input,output); real D1,D2,S,D,P,Q:integer; begin read(D1,D2); S:=D1+D2;D:=D1-D2;P:=D1*D2;Q:=D1/D2; writeln(D1,D2); writeln(S,D,P,Q); end. だとエラーが出るんですけど、どこが違うのでしょう?
program PR0203(input,output); var W,L,H,V,S:integer; begin readln(W,L);raldln(H);writeln(W,L,H); V:=W*L*H;S:=2*(W*(L+H)+L*H); writeln(V,S); end.
これでエラーが出るのは何故なんでしょう?
PR0203.pas(4,21) Error: Identifier not found "raldln" PR0203.pas(4,24) Error: Illegal expression PR0203.pas(4,25) Warning: Variable "H" does not seem to be initialized PR0203.pas(8) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted Error: C:\FPC\2.2.0\bin\i386-Win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled)
program PR0331(input,output); var D1,D2:real; var T1,T2,T3,T4,R1,R2,R3,R4:integer; begin read(D1,D2); T1:=trunc(D1);T2:=trunc(D2);T3:=trunc(-D1);T4:=trunc(-D2); R1:=round(D1);R2:=round(D2);R3:=round(-D1);R4:=round(-D2); writeln('trunc(',D1:2:1,')=',T1:2,'trunc(',D2:2:1,')=',T2:2,'trunc(',-D1:2:1,')=',T3:2,'trunc(',-D2:2:1,')=',T4:2); writeln('round(',D1:2:1,')=',R1:2,'round(',D2:2:1,')=',R2:2,'round(',-D1:2:1,')=',R3:2,'round(',-D2:2:1,')=',R4:2); end.
writeln('Data Entered : ', D1, D2); writeln('Trunc''s of them are ', trunc(D1), ' and ', trunc(D2), ' respectivly.'); writeln('Trunc''s of negated them are ', trunc(-D1), ' and ', trunc(-D2), ' respectivly.'); writeln('Round''s of them are ', round(D1), ' and ', round(D2), ' respectivly.'); writeln('Round''s of negated them are ', round(-D1), ' and ', round(-D2), ' respectivly.'); writeln('Thus, both functions are (different from / same for) each other in case of (you must fill this parenthesis ).')
605 名前:デフォルトの名無しさん [2007/10/09(火) 21:31:21 ]
program PR0331(input,output); const D1=0.4;D2=0.5;D3=-0.4;D4=-0.5; var T1,T2,T3,T4,R1,R2,R3,R4:integer; begin T1:=trunc(D1);T2:=trunc(D2);T3:=trunc(D3);T4:=trunc(D4); R1:=round(D1);R2:=round(D2);R3:=round(D3);R4:=round(D4); writeln('trunc(',D1:4:1,')=',T1:2,' trunc(',D2:4:1,')=',T2:2,' trunc(',-D1:4:1,')=',T3:2,' trunc(',-D2:4:1,')=',T4:2); writeln('round(',D1:4:1,')=',R1:2,' round(',D2:4:1,')=',R2:2,' round(',-D1:4:1,')=',R3:2,' round(',-D2:4:1,')=',R4:2); end.
program PR0311(input,output); ver D1,D2:integer; ver O1,O2,E1,E2:Boolean; begin read(D1,D2); O1:=odd(D1);D2:=odd(D2); E1:=even(D1);E2:=even(D2); writeln(' odd(',D1,')=',O1);writeln(' odd(',D2,')=',O2); writeln('even(',D1,')=',E1);writeln('even(',D2,')=',E2); end.
program PR0311(input,output); ver D1,D2:integer; begin read(D1,D2); writeln(' odd(',D1,')=',odd(D1));writeln(' odd(',D2,')=',odd(D2)); writeln('even(',D1,')=',even(D1));writeln('even(',D2,')=',even(D2)); end.
エラーメッセージ Free Pascal Compiler version 2.2.0 [2007/09/09] for i386 Copyright (c) 1993-2007 by Florian Klaempfl Target OS: Win32 for i386 Compiling PR0311.pas Fatal: Syntax error, "BEGIN" expected but "identifier VER" found Fatal: Compilation aborted Error: C:\FPC\2.2.0\bin\i386-Win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled)
Program Viva2chan(output); type courses = (programming, algebra, circuit, english, electromagnetics); coursset = set of courses; var studentA, studentB, studentC : coursset;
procedure DispSet(s : coursset); begin if programming in s then write('Programming'); if algebra in s then write('Algebra'); if circuit in s then write('Circuit'); if english in s then write('English'); if electromagnetics in s then write('Electromagnetics'); writeln end;
function factrial(i:integer): real; begin if n=1 then begin factrial := 1; end else begin factrial := i*factrial(i-1); end; begin write('Enter n : '); readln(n); For i:=1 to n do begin ANS:=1+(1/factrial); end; end;
function factrial(i:integer): real; begin if n=1 then begin factrial := 1; end else begin factrial := i*factrial(i-1); end; begin write('Enter n : '); readln(n); For i:=1 to n do begin ANS:=ANS+(1/factorical(i)); end; end; begin
function factorial(i:integer) : real; begin if i = 1 then factorial := 1 else factorial := i * factorial(i - 1) end; begin write('Enter n : '); readln(n); For i := 1 to n do ANS := ANS + (1. / factorial(i)); writeln('N = ', n, ' ANS = ', ANS:8:6); readln; end.
const USD = 118.94; GBP = 186.53; CNY = 13.93; EUR = 129.60; RUB = 3.73; var c : char; j, k : real; begin repeat writeln('********************'); writeln('d--USDOLLAR'); writeln('P--British Pound'); writeln('y--Chinese Yuan(gen)'); writeln('e--Euro'); writeln('r--Russian Rouble'); writeln('*****************'); write('Exchange to : '); readln(c); until (c = 'd') or (c = 'P') or (c = 'y') or (c = 'e') or (c = 'r'); write('Enter the amout of money in JPY : '); readln(j); case c of 'd' : begin k := j / USD; writeln('USD = $', k : 8 : 2) end; 'P' : begin k := j / GBP; writeln('GBP = ', k : 8 : 2, ' pound') end;
>>668 program prog1(input, output); var i,j,k : integer; a:array[1..9] of array[1..9] of array[1..9] of integer; begin for i := 1 to 9 do for j :=1 to 9 do for k :=1 to 9 do a[i,j,k]:=i*j*k;
for i := 1 to 9 do begin writeln('i=',i); for j := 1 to 9 do begin for k :=1 to 9 do write(a[i,j,k]:6); writeln(); end end end.
>>671 program prog1(input, output); var x,c: real; function f(x,c : real) :real; begin f := x*x-c; end;
function fd(x : real) :real; begin fd := 2*x; end; begin writeln('xの平行根の近似値を求めます'); write('x : '); read(c); x := c; while abs(f(x,c)) >0.0001do begin writeln(x,' ',f(x,c)); x := x-f(x,c)/fd(x); end; writeln(c,'の平行根の近似値は',x); end.