Program func; var i, y: real; function MyFunction(x: real): real; begin MyFunction := ( Exp(x) + Cos(x) ); end; begin i := -1; assign(output, 'output.txt'); rewrite(output); while i <= 1.5 do begin x := MyFunction(i); write(output, x, ' '); i := i + 0.1; end; close(output); assign(input, 'output.txt'); reset(input); writeln('Содержимое файла:'); writeln( readln(input) ); end.
var
i, y: real;
function MyFunction(x: real): real;
begin
MyFunction := ( Exp(x) + Cos(x) );
end;
begin
i := -1;
assign(output, 'output.txt');
rewrite(output);
while i <= 1.5 do
begin
x := MyFunction(i);
write(output, x, ' ');
i := i + 0.1;
end;
close(output);
assign(input, 'output.txt');
reset(input);
writeln('Содержимое файла:');
writeln( readln(input) );
end.