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;
var a,b,c:string;
i,d1,d2:integer;
begin
clrscr;
write('Nhap xau a:'); readln(a);
write('Nhap xau b:'); readln(b);
d1:=length(a);
d2:=length(b);
writeln('Tong do dai hai xau la: ',d1+d2);
c:=#32;
for i:=1 to d1 do
if (a[i] in ['A'..'Z']) or (a[i] in ['a'..'z']) then c:=c+a[i];
for i:=1 to d2 do
if b[i] in ['0'..'9'] then c:=c+b[i];
writeln('Xau c la: ',c);
readln;
end.
uses crt;
var a,b,c:string;
i,d1,d2:integer;
begin
clrscr;
write('Nhap xau a:'); readln(a);
write('Nhap xau b:'); readln(b);
d1:=length(a);
d2:=length(b);
writeln('Tong do dai hai xau la: ',d1+d2);
c:=#32;
for i:=1 to d1 do
if (a[i] in ['A'..'Z']) or (a[i] in ['a'..'z']) then c:=c+a[i];
for i:=1 to d2 do
if b[i] in ['0'..'9'] then c:=c+b[i];
writeln('Xau c la: ',c);
readln;
end.
1:
uses crt;
const fi='ketqua.txt';
var f1:text;
st:string;
i,d:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap xau:'); readln(st);
d:=length(st);
for i:=1 to d do
if st[i]=#32 then delete(st,i,1);
writeln(f1,st);
close(f1);
end.
2:
uses crt;
var a,b,c,d:integer;
{----------chuong-trinh-con-----------------------}
function min(x,y:integer):integer;
begin
if x<y then min:=x
else min:=y;
end;
{---------------chuong-trinh-chinh--------------------}
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
write('d='); readln(d);
writeln(min(a,min(b,min(c,d))));
readln;
end.
2:
#include <bits/stdc++.h>
using namespace std;
string st1,st2;
int d1,d2;
int main()
{
getline(cin,st1);
getline(cin,st2);
d1=st1.length();
d2=st2.length();
if (d1>d2) cout<<st1;
else cout<<st2;
return 0;
}
Chương trình:
program bai_10_chuong_4;
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:'); readln(s); dem:= 0;
for i:= 1 to length(s) do
if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
writeln('Xau vua nhap la: ',st);
dem:=0;
for i:=1 to d do
if st[i] in ['0'..'9'] then inc(dem);
writeln(dem);
readln;
end.
uses crt;
var st,s:string;
i,d,dem,kt,j,dem1:integer;
begin
clrscr;
write('Nhap xau:'); readln(s);
writeln('Xau vua nhap la: ',s);
d:=length(s);
for i:=1 to d do
if s[i]=#32 then delete(s,i,1);
dem:=1;
st[1]:=s[1];
for i:=1 to d do
begin
kt:=0;
for j:=1 to dem do
if s[i]=st[j] then kt:=1;
if kt=0 then
begin
inc(dem);
st[dem]:=s[i];
end;
end;
for i:=1 to dem do
begin
dem1:=0;
for j:=1 to d do
if st[i]=s[j] then inc(dem1);
writeln(st[i],' xuat hien ',dem1,' lan');
end;
readln;
end.
program NhapXau;
var
Chuoi_A, Chuoi_B : string;
i : integer;
begin
write('Nhap xau A: ');
readln(Chuoi_A);
writeln('Xau A la: ', Chuoi_A);
Chuoi_B := '';
for i := 1 to length(Chuoi_A) do
Chuoi_B := Chuoi_B + Chuoi_A[i];
writeln('Xau B la: ', Chuoi_B);
readln;
end.
uses crt;
var a,b:string;
begin
clrscr;
write('Nhap xau a:'); readln(a);
write('Nhap xau b:'); readln(b);
writeln(length(a)+length(b));
readln;
end.