K
Khách

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.

27 tháng 4 2020

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 .

27 tháng 4 2020

Bạn làm gì vậy :V? Mình không hiểu

Câu 1: 

uses crt;

var st:string;

d,i,dem:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

write('Xau sau khi xoa so la: ');

for i:=1 to d do 

  if not(st[i] in ['0'..'9']) then write(st[i]);

writeln;

dem:=0;

for i:=1 to d do 

  if st[i]=#32 then inc(dem);

writeln('Xau co ',dem,' dau cach');

writeln('Do dai cua xau la: ',d);

readln;

end. 

Câu 2: 

uses crt;

const fi='kq.out';

var st1,st2:string;

f1:text;

begin

clrscr;

write('Nhap xau thu 1:'); readln(st1);

write('Nhap xau thu 2:'); readln(st2);

assign(f1,fi); rewrite(f1);

if length(st2)>length(st1) then writeln(f1,st2)

else writeln(f1,st1);

close(f1);

end.

uses crt;

var st:string;

a:array[1..255]of string;

i,n,d,kt,j,dem,dem1,dem2:integer;

begin

clrscr;

readln(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

dem:=dem+1;

a[dem]:=st[i];

end;

end;

dem1:=0;

dem2:=0;

for i:=1 to dem do 

begin

if st[i] in ['A'..'Z'] then dem1:=dem1+1;

if st[i] in ['a'..'z'] then inc(dem1);

if st[i] in ['0'..'9'] then inc(dem2);

end;

writeln(dem1);

writeln(dem2);

readln;

end.

const fi='xau.inp';

fo='xau.out';

var f1,f2:text;

a:array[1..100]of string;

i,d: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 

  begin

for j:=1 to length(a[i]) do 

  a[i][j]:=upcase(a[i][j]);

end;

for i:=1 to n do 

  writeln(f2,length(a[i]),' ',a[i]);

close(f1);

close(f2);

end.

26 tháng 2 2021

Program HOC24;

const fi='bai24.inp';

fo='bai24.out';

var f: text;

s: string;

procedure ip;

begin

assign(f,fi);

reset(f);

read(f,s);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

if s='palindrome' then write(f,'La xau palindrome') else write(f,'Khong phai xau palindrome');

close(f);

end;

begin

ip;

out;

end.

26 tháng 2 2021

Không đúng rồi ạ

#include <bits/stdc++.h>

using namespace std;

string st;

int dem,i,d;

int main()

{

getline(cin,st);

d=st.length();

dem=0;

for (i=0; i<=d-1; i++)

if ((st[i]=='a') or (st[i]=='A')) dem++;

cout<<dem;

return 0;

}

 

25 tháng 7 2021

cau 1:

uses crt;

var a:array[1..100] of integer;

n,i,min: integer;

begin

readln(n);

for i:=1 to n do

readln(a[i]);

min:=a[1];

for i:=2 to n do

if min>a[i] then min=a[i];

writeln(a[i]);

readln;

end.

cau 2:

uses crt;

g:text;

s:string;

const fo='CHUSO.TXT';

begin

assign(g,fo);

rewrite(g);

readln(s);

for i:=1 to length(s) do

if not((s[i] in ['a'..'z'])and(s[i] in ['A'..'Z])) then delete(s,i,1);

writeln(g,s);

end.

26 tháng 3 2023

chuoi = input("Nhập vào một chuỗi ký tự: ")

kieu_du_lieu_cu = type(chuoi)

kieu_du_lieu_moi = str

# tạo một danh sách chứa tất cả các ký tự xuất hiện trong chuỗi

ky_tu_can_loai_bo = ['a', 'e', 'i', 'o', 'u']

# loại bỏ các ký tự nằm trong danh sách khỏi chuỗi

chuoi = ''.join([c for c in chuoi if c.lower() not in ky_tu_can_loai_bo])

print("Chuỗi sau khi xóa các ký tự: ", chuoi)

uses crt;

var st:string;

i,d,dem:integer;

begin

clrscr;

readln(st);

d:=length(st);

dem:=0;

for i:=1 to d do 

  if st[i]='H' then inc(dem);

writeln(dem);

readln;

end.