Cho tệp văn bản có tên DATA2.TXT chứa một xâu bất kì không quá 255 kí tự gồm các chữ và số. Viết chương trình đọc xâu kí tự S từ từ tệp DATA2.TXT sau đó ghi dữ liệu là các thông tin sau vào tệp KQ2.TXT:
- Dòng 1: Số lần xuất hiện của kí tự "k" trong xâu?
- Dòng 2: Số lượng kí tự là số xuất hiện trong S (giữ nguyên thứ tự xuất hiện)?
Cho tệp văn bản có tên DATA2.TXT chứa một xâu bất kì không quá 255 kí tự gồm các chữ và số. Viết chương trình đọc xâu kí tự S từ từ tệp DATA2.TXT sau đó ghi dữ liệu là các thông tin sau vào tệp KQ2.TXT:
- Dòng 1: Số lần xuất hiện của kí tự "k" trong xâu?
- Dòng 2: Số lượng kí tự là số xuất hiện trong S (giữ nguyên thứ tự xuất hiện)?
Cho tệp văn bản có tên DATA2.TXT chứa một xâu bất kì không quá 255 kí tự gồm các chữ và số. Viết chương trình đọc xâu kí tự S từ từ tệp DATA2.TXT sau đó ghi dữ liệu là các thông tin sau vào tệp KQ2.TXT:
- Dòng 1: Số lần xuất hiện của kí tự "k" trong xâu?
- Dòng 2: Số lượng kí tự là số xuất hiện trong S (giữ nguyên thứ tự xuất hiện)?
Help me!!! Mai mk thi ạ
Cho tệp văn bản có tên DATA2.TXT chứa một xâu bất kì không quá 255 kí tự gồm các chữ và số. Viết chương trình đọc xâu kí tự S từ từ tệp DATA2.TXT sau đó ghi dữ liệu là các thông tin sau vào tệp KQ2.TXT:
- Dòng 1: Số lần xuất hiện của kí tự "k" trong xâu?
- Dòng 2: Số lượng kí tự là số xuất hiện trong S (giữ nguyên thứ tự xuất hiện)?
Cho 2 tệp văn bản nguyen1.TXT , nguyen2.TXT . Mỗi dòng của 2 tệp chứa 1 số nguyên . Hãy lập trình tạo tệp 1 văn bản chứa nguyen1.TXT , nguyen2TXT . Những dòng đầu tiên là các dòng của nguyen1.TXT , còn lại là nguyen2.TXT
const fi1='nguyen1.txt'
fi2='nguyen2.txt'
fo='nguyen.txt'
var f1,f2,f3:text;
a,b:array[1..100]of integer;
n,m,i:integer;
begin
assign(f1,fi1); reset(f1);
assign(f2,fi2); reset(f2);
assign(f3,fo); rewrite(f3);
n:=0;
while not eof(f1) do
begin
inc(n);
readln(f1,a[n]);
end;
m:=0;
while not eof(f2) do
begin
m:=m+1;
readln(f1,b[m]);
end;
for i:=1 to n do
writeln(f3,a[i]);
for i:=1 to m do
writeln(f3,b[i]);
close(f1);
close(f2);
close(f3);
end.
Viết chương trình nhập vào mảng một chiều C gồm có n số nguyên. Ghi mảng C vừa nhập vào tệp có tên là MANG3.TXT. Đọc dữ liệu từ tệp MANG3.TXT, in ra màn hình các số lẻ trong mảng.
Program HOC24;
var i,n: integer;
c: array[1..1000] of integer;
f: text;
begin
assign(f,'MANG3.TXT');
reset(f);
readln(f,n);
for i:=1 to n do read(f,c[i]);
close(f);
for i:=1 to n do if c[i] mod 2=1 then write(c[i],' ');
readln
end.
Viết chương trình nhập vào mảng một chiều C gồm có n số nguyên. Ghi mảng C vừa nhập vào tệp có tên là MANG3.TXT. Đọc dữ liệu từ tệp MANG3.TXT, in ra màn hình các số lẻ trong mảng.
CHo tệp DULIEU TXT gồm nhiều dòng mỗi dòng gồm 2 số nguyên x và y. Đọc dữ liệu từ tệp vào ghi ra tệp KETQUA TXT số nhỏ hơn trong 2 số,mỗi số ghi trên 1 dòng.
const fi='dulieu.txt'
fo='ketqua.txt'
var f1,f2:text;
a,b:array[1..100]of integer;
n,i: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],b[n]);
end;
for i:=1 to n do
begin
if (a[i]<b[i]) then writeln(f2,a[i])
else writeln(f2,b[i]);
end;
close(f1);
close(f2);
end.
Viết chương trình đọc từ tệp " input.txt" ( tệp " input .txt" chứa 4 số nguyên ) ghi vào tệp " output.txt" tổng 4 số nguyên trong tệp " input.txt" Tong là:10
#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;
}