Viết chương trình nhập vào 2 xâu kí tự. Xâu thứ nhất là họ đệm, xâu thứ 2 là tên của 1 người.Đưa ra màn hình tên đầy đủ của người đó.
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.
![](https://rs.olm.vn/images/avt/0.png?1311)
![](https://rs.olm.vn/images/avt/0.png?1311)
Câu 1:
ho_ten = input("Nhập họ tên: ")
tach_ho_ten = ho_ten.split()
if len(tach_ho_ten) > 1:
ten = tach_ho_ten[-1]
print("Tên của bạn là:", ten)
else:
print("Nhập sai định dạng họ tên")
Câu 2:
s = input("Nhập xâu: ")
hoa = s.upper()
print(hoa)
![](https://rs.olm.vn/images/avt/0.png?1311)
uses crt;
var st1,st2:string;
begin
clrscr;
readln(st1,st2);
if st1>st2 then writeln('Xau st1 lon hon')
else if st2>st1 then writeln('Xau st2 lon hon')
else writeln('Hai xau bang nhau');
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i;
int main()
{
getline(cin,st);
d=st.length()
for (i=0; i<=d-1; i++)
if (('a'<=st[i]) and (st[i]<='z')) st[i]=st[i]+32;
for (i=0; i<=d-1; i++)
cout<<st[i];
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
program tach_ho_ten;
uses crt;
var
s, ho_dem, ten: string;
i, vt: integer;
begin
write('Nhap xau s: ');
readln(s);
vt := 0;
for i := length(s) downto 1 do
begin
if s[i] = ' ' then
begin
vt := i;
break;
end;
end;
ho_dem := copy(s, 1, vt-1);
ten := copy(s, vt+1, length(s)-vt);
writeln('Ho dem: ', ho_dem);
writeln('Ten : ', ten);
readln;
end.
program ct;
uses crt;
var
s1,s2:string;
begin
clrscr;
write('nhap ho dem: ');
readln(s1);
write('nhap ten: ');
readln(s2);
writeln('ten day du la: ',s1,' ',s2);
readln;
end.