Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
uses crt;
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
a,b:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b);
if (a=0) and (b=0) then writeln(f2,'Phuong trinh co vo so nghiem');
if (a<>0) then writeln(f2,-b/a:4:2);
if (a=0) and (b<>0) then writeln(f2,'Phuong trinh vo nghiem');
close(f1);
close(f2);
end.
const fi='input.txt';
fo='soan.txt';
var f1,f2:text;
a:array[1..100]of integer;
i,n:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,a[n]);
end;
for i:=1 to n do
if a[i]<0 then writeln(f2,a[i]:4);
close(f1);
close(f2);
end.
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
a:array[1..20]of integer;
i,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem:=0;
while not eoln(f1) do
begin
inc(dem);
read(f1,a[dem]);
end;
for i:=1 to dem do
if a[i] mod 10=0 then writeln(f2,i);
close(f1);
close(f2);
end.
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
st:string[125];
a:array[1..125]of string;
i,d,dem,kt,j:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,st);
d:=length(st);
dem:=1;
a[1]:=st[1];
for i:=1 to d do
begin
kt:=0;
for j:=1 to dem do
if a[j]=st[i] then kt:=1;
if kt=0 then
begin
inc(dem);
a[dem]:=st[i];
end;
end;
for i:=1 to dem do
begin
dem1:=0;
for j:=1 to d do
if a[i]=st[j] then inc(dem1);
writeln(f2,a[i],' xuat hien ',dem1,' lan');
end;
close(f1);
close(f2);
end.
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
a,b,c,max:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b,c);
min:=a;
if min>b then min:=b;
if min>c then min:=c;
writeln(f2,min);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,d;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
cin>>a>>b>>c>>d;
cout<<a+b+c+d;
return 0;
}
var s:string;
f1:text;
a:byte;
begin
assign(f1,'c:\ghixau1.txt'); rewrite(f1);
readln(s);
writeln(f1,s);
close(f1);
End.
Câu 2:
a) Chương trình có 2 tệp và 2 biến tệp
- 2 tệp đó là : input.txt và output.txt
- 2 biến tệp đó là: f1 và f2
b)
- Tệp input.txt được gắn cho biến tệp là f1 .Nó dùng để đọc dữ liệu
-Tệp output.txt được gắn cho biết tệp là f2. Nó dùng để ghi dữ liệu
c)
Câu lệnh gắn tập và mở tệp của input.txt và output.txt là : assign(f1 ,' input.txt'); và assign(f2 ,' output.txt);
Câu lệnh đọc tệp là: reset(f1);
Câu lệnh để ghi tệp là: rewrite(f2);
d) Điều kiện để tham chiếu đến tất cả các cặp số nguyên trong tệp input.txt là phải có biến tệp f1 ở trước mọi câu lệnh đọc dữ liệu.
e) Chương trình có 2 lệnh đóng tệp. Không thể không đóng tệp , vì nếu không đóng thì dữ liệu đã thực hiện không thể lưu lại .
Program hotrotinhoc_hoc24;
const fi='C:\Input.txt';
fo='C:\Output.txt';
var f: text;
i,n: integer;
procedure ip;
begin
assign(f,fi);
reset(f);
read(f,n);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
for i:=1 to n do write(f,i,' ');
close(f);
end;
begin
ip;
out;
end.
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
i,n:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
write(f2,i:4);
close(f1);
close(f2);
end.
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
st:string;
i,d:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,st);
d:=length(st);
for i:=1 to d do
if st[i]='n' then write(f2,i:4);
close(f1);
close(f2);
end.