Những câu hỏi liên quan
Lan Anh
Xem chi tiết
Nguyenthi Tien
Xem chi tiết
Cherry
21 tháng 3 2021 lúc 16:03

 câu 1 Uses Crt;

Var St:String;

dem: Array[‘A’..’Z’] Of Byte

; i:Byte;

ch:Char;

Begin Write(‘Nhap xau St: ‘);

Readln(St);

{Khởi tạo mảng} For ch:=’A’ To ‘Z’ Do dem[ch]:=0;

{Duyệt xâu} For i:=1 To Length(St) Do If Upcase(St[i]) IN [‘A’..’Z’] Then Inc(dem[Upcase(St[i])]);

{Liệt kê các ký tự ra màn hình} For ch:=’A’ To ‘Z’ Do If dem[ch]>0 Then Writeln(ch,’ : ’,dem[ch]);

Readln;

Bình luận (1)
thiên hiền lê
21 tháng 3 2021 lúc 16:30

Hehe,con sâu

Bình luận (0)
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 20:49

uses crt;

var st:string;

i,d,kt:integer;

ktu:char;

begin

clrscr;

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

write('Nhap ki tu:'); readln(ktu);

d:=length(st);

kt:=0;

for i:=1 to d do 

  if ktu=st[i] then kt:=1;

if kt=0 then writeln(ktu,' khong co trong xau')

else writeln(ktu,' co trong xau');

readln;

end.

Bình luận (0)
luc lun
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 12 2021 lúc 23:09

#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;
}

 

Bình luận (1)
Khánh Mỹ
Xem chi tiết
_Jun(준)_
3 tháng 3 2021 lúc 18:05

 Cậu tham khảo nhé!!!

https://hoc24.vn/cau-hoi/viet-chuong-trinh-nhap-mot-xau-tu-ban-phim-thay-ky-tu-39a39-thanh-39i39-va-in-xau-da-thay-ra-man-hinh-thay-tat-ca-chu-39anh39-t.257698320219

Bình luận (0)
Nguyễn Lê Phước Thịnh
3 tháng 3 2021 lúc 19:37

uses crt;

var s:string;

begin

clrscr;

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

while pos('a',s)<>0 do

begin

insert('i',s,pos('a',s));

delete(s,pos('a',s),1);

end;

write('Xau sau khi chuyen la : ',s);

readln;

end.

Bình luận (0)
Nguyễn An
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 7 2021 lúc 14:32

uses crt;

var s,s1,s2:string;

i,d:integer;

begin

clrscr;

readln(s);

s1:=''

s2:=''

d:=length(s);

for i:=1 to d do

  begin

if s[i] in ['0'..'9'] then s1:=s1+s[i];

if (s[i] in ['a'..'z']) or (s[i] in ['A'..'Z']) then s2:=s2+s[i];

end;

writeln('Xau chua cac ki tu so la: ',s1);

writeln('Xau chua cac ki tu chu la: ',s2);

readln;

end.

Bình luận (0)
Khánh Mỹ
Xem chi tiết
Trần Mạnh
3 tháng 3 2021 lúc 17:23

Chương trình:program bai_10_chuong_4;uses crt;vars: string[100];i, dem: integer;Beginclrscr;write('Nhap xau vao:'); readln(s); dem:= 0;for i:= 1 to length(s) doif ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;Writeln('Trong xau s co '»dem,' chu so thap phan');readln;End.

Bình luận (1)
Nguyễn Lê Phước Thịnh
3 tháng 3 2021 lúc 19:44

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

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

d:=length(st);

for i:=1 to d do 

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

readln;

end.

Bình luận (0)
Lộc Nguyễn
Xem chi tiết
Nguyên văn A
Xem chi tiết
Minh Lệ
1 tháng 9 2021 lúc 21:57

Program HOC24;

var s: string;

i: byte;

begin

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

for i:=1 to n do if not(s[i] in ['0'..'9']) then write(s[i]);

readln

end.

Bình luận (0)
Nguyễn Hạnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 4 2021 lúc 19:21

uses crt;

var s:string;

i,d,dem1,dem2,dem3,dem4:integer;

begin

clrscr;

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

d:=length(s);

dem1:=0;

dem2:=0;

dem3:=0;

dem4:=0;

for i:=1 to d do 

  begin

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

else if st[i] in ['a'..'z'] then inc(dem2)

else if st[i] in ['A'..'Z'] then inc(dem3)

else inc(dem4);

end;

writeln('So luong ky tu so la: ',dem1);

writeln('So luong ky tu thuong la: ',dem2);

writeln('So luong ky tu hoa la: ',dem3);

writeln('So luong ky tu dac biet la: ',dem4);

readln;

end.

Bình luận (0)