How to make the data entered not from the keyboard, but from the .txt file?
Program pf; var x,y,a,b:integer; begin read(x); read(y); a:=x; b:=y; if x>y then begin x:=a*b; y:=a+b; end else begin x:=a+b; y:=a*b; end; write(x,y); end. How to make the data entered not from the keyboard, but from the .txt file?
Program pf; var x,y,a,b:integer; begin read(x); read(y); a:=x; b:=y; if x>y then begin x:=a*b; y:=a+b; end else begin x:=a+b; y:=a*b; end; write(x,y); end. First add the code (after begin)
assign(input, 'input.txt'); reset(input); assign(output, 'output.txt'); rewrite(output); It is not difficult to guess that input.txt and output.txt is the name of the input and output files, respectively.
Source: https://ru.stackoverflow.com/questions/757962/
All Articles