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.
#include <bits/stdc++.h>
using namespace std;
string st1,st2;
int d1,d2;
int main()
{
cin>>st1>>st2;
d1=st1.length();
d2=st2.length();
if (d1<d2) cout<<st1;
else cout<<st2;
return 0;
}
uses crt;
var a,b:string;
i,d:integer;
begin
clrscr;
write('Nhap xau a:'); readln(a);
d:=length(a);
b:='';
for i:=1 to d do
if a[i] in ['A'..'Z'] then b:=b+a[i];
writeln(b);
readln;
end.
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.
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.
Program Xau;
Uses crt;
Var St: String;
i: longint;
Begin
Clrscr;
Write('Nhap xau: '); Readln(St);
For i:=1 to length(St) do
St[i] := Upcase(St[i]);
Write('St = ',St);
Readln
End.
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
readln(st);
d:=length(st);
for i:=1 to d do
if not (st[i] in ['0'..'9']) then write(st[i]);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int d,i,d1;
string st;
int main()
{
getline(cin,st);
d=st.length();
while (st[0]==32)
{
st.erase(0,1);
}
while (st[d-1]==32)
{
st.erase(d-1,1);
}
d1=st.length();
for (i=0; i<d1; i++)
if ((st[i]==32) && st[i+1]==32)
{
st.erase(i,1);
i--;
}
cout<<st;
return 0;
}
2:
uses crt;
var st:string;
d,i,dem1,dem2:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
dem1:=0;
dem2:=0;
for i:=1 to d do
begin
if st[i] in ['0'..'9'] then inc(dem1);
if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then inc(dem2);
end;
writeln('So ki tu la chu so la: ',dem1);
writeln('So ki tu la chu cai la: ',dem2);
for i:=1 to d do
if st[i] in ['0'..'9'] then delete(st,i,1);
writeln('Xau sau khi xoa cac chu so la: ',st);
readln;
end.
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau: '); readln(s);
for i:=1 to length(s) do if (s[i]<>#32) and (s[i] in 'A'..'z') then
begin
upcase(s[i]); write(s[i]);
end;
readln
end.
thiếu array kìa dmmm mẹ m béoooo