ICT
the blog for ICT
ken013194
暱稱: ホロ
性別: 男
國家: 香港
地區: 葵青區
« June 2026 »
SMTWTFS
123456
78910111213
14151617181920
21222324252627
282930
最新文章
Text File
Arrays
String Procedures
String Functions
String Operation
文章分類
全部 (23)
Programming Language (23)
訪客留言
最近三個月尚無任何留言
每月文章
日誌訂閱
尚未訂閱任何日誌
好友名單
尚無任何好友
網站連結
尚無任何連結
最近訪客
最近沒有訪客
日誌統計
文章總數: 23
留言總數: 0
今日人氣: 0
累積人氣: 49
站內搜尋
RSS 訂閱
RSS Feed
2009 年 9 月 11 日  星期五   晴天


Formatting Output 分類: Programming Language

High-level Programming Language (Pascal)

Formatting Output

  • the output format of an item can be specified by appending a format descriptor to the item in an output list
  • the format descriptor takes one of the following forms :

    :<w> or :<w> :<d>

    • where w and d are integer-valued expressions
    • :<w> is the field width

      • specifies that the value is to be displayed in a field consisting of w spaces
      • the value will be right justified in this field
      • real values will be displayed in exponential form
      • if the size of the field is too small, the field will be enlarged for the values

    • :<w> :<d> is used to display real values in decimal form

      • w is the field width, and d is the number of digits to be displayed to the right of the decimal points
      • negative sign, decimal point and exponent symbol E form part of the field width
      • the value will be rounded to a places or zero padded as necessary

  • a list of examples

    Action
    Statement
    Output
    123456789012345
    Formatting integer values writeln (1235 :5);
    writeln (1235 :0);
     1235
    1235

     

    Real values

    writeln (1.235 :10);
    writeln (1.235 :1:2);
     1.235E+01
    1.24

     

     

    Characters and strings

    writeln ('A' :5);
    writeln ('ABC' :0);
          A
    ABC


I/O Statement 分類: Programming Language

High-level Programming Language (Pascal)

Program Input and Output

To be useful, a program needs some means to communicate with the user. They are input statements and output statements.

Input Statements



Data Type 分類: Programming Language

High-level Programming Language (Pascal)

Data Types

  • determines how the value is represented in the memory
  • Pascal provides a number of predefined data types
  • denoted by the sta......

    (閱讀全文)


Punctuation 分類: Programming Language

High-level Programming Language (Pascal)

Identifiers



Identifier 分類: Programming Language

High-level Programming Language (Pascal)

Identifiers