Viết chương trình đếm các ký tự chữ trong xâu Pascal

Viết chương trình đếm các ký tự chữ trong xâu Pascal

Ôn tập Từ khóa

Các từ khoá là các từ dành riêng của Pascal mà người lập trình có thể sử dụng chúng trong chương trình để thiết kế chương trình. Không được dùng từ khoá để đặt cho các tên riêng như tên biến, tên kiểu, tên hàm…

Một số từ khoá của Pascal gồm:

  • And External Mod Shr
  • Array File Nil String
  • Begin For Not Then
  • Case Function Object To
  • Const Goto Of Type
  • Constructor If Or Unit
  • Div Implementation Packed Until
  • Do In Procedure Uses
  • Downto Inline Program Var
  • Else Interface Record Virtual
  • End Label Repeat While
  • Set Shl With Xor

Bài giải

Program Dem_kytu;

Uses crt;

Var I,dem_chu, dem_so, tong: integer;

S: string;

Begin

    Clrscr;

    Write('Nhap xau S: '); Readln(S);

    Dem_chu:=0;

    For i:=1 to length(S) do

    If S[i] in ['A'..'Z']+['a'..'z'] then

    Dem_chu:=dem_chu+1 else

    Dem_so:=dem_so+1;
    
    tong:= Dem_so + Dem_chu;

    Writeln('Trong xau S co tat ca ',tong,' ky tu');
    
    readln;

End.

Hình minh họa

Hình minh họa

Bạn thấy bài viết này như thế nào?: 
Average: 6 (2 votes)
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Bình luận (0)

 

Add Comment

Filtered HTML

  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Các thẻ HTML được chấp nhận: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Tự động ngắt dòng và đoạn văn.

Plain text

  • No HTML tags allowed.
  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Tự động ngắt dòng và đoạn văn.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Adding Metadata to Drupal Nodes

Thêm Metadata cho Drupal Nodes để Seo

This week's tutorial explains how to add metadata to your Drupal site. By default, Drupal has no fields for metadata. Check the source code at http://drupal.org and you'll see what I mean. To fix that issue, we recommend a module called Nodewords.

Guzzle, học Guzzle trong 5 PHP Components của Drupal 8

Guzzle, học Guzzle trong 5 PHP Components của Drupal 8

Since we’ve been away from our composer project for a while, let’s start by updating it and getting the newest available code.

Google xác nhận Pixel 3a sau Google Pixel 3 và 3 XL dự kiến ra mắt tại Google I/O 2019

Google xác nhận Pixel 3a sau Google Pixel 3 và 3 XL dự kiến ra mắt tại Google I/O 2019

Ngay sau khi bộ đôi Google Pixel 3 và 3 XL, Goolge lại tiếp tục ra mắt các phiên bản rẻ hơn mang tên Pixel 3 Lite và Pixel 3 XL Lite. Và mới đây, bộ đôi này đã chính thức đạt chứng nhận của FCC.

Công ty diệt chuột T&C

 

Diet con trung