English is free for programmer ตอนที่ 4

ตอนที่ 4 ประกอบด้วยหัวข้อต่าง ๆ ดังนี้

1 Definition And Terminology

2 Reading Trendy News And Articles

3. Attendance Quiz

4. Assignment Quiz

วีดีโอ

READING 01 – PROGRAMMING LANGUAGES File

Read the program and the text below.01: /* CALCULATE AVERAGES */
02: main() {
03: float a ,b,c,d.average;
04:
05: printf(“Enter three numbers:”);
06: scanf(“%f %f %f”, &a, &b, &c);
07:
08: d = a + b + c;
09: average = d / 3.0;
10:
11: printf(“The average is %faverage);
12: } 

# Comment Lines
A C source program consists of statements and comment lines. Comment lines are enclosed by the characters /* (at the start of the comment) and */ (at the end of the comment).

 

# The Function main () { }
Every C program must have a function called “main” which must appear only once in a program. The parentheses following the word “main” must be present, but there must be no parameters included. The main part of the program is enclosed within braces {}, and consists of declaration statements, assignment statements, and other C functions. In the above program there are six statements within the braces: a declaration statement (the first statement of the main program starting with the word “float”), two assignment statements (the fourth and fifth statements starting with the variable names “d” and “average”), and three function statements, two to print information on the screen and one to scan the keyboard for input.As C is a free form language, the semicolon (;) at the end of each line is a must. It acts as a statement terminator, telling the compiler where an instruction ends. Free form means that statements can be identified and blank lines inserted in the source file to improve readability, and statements can span several lines. However, each statement must be terminated with a semicolon. If you forget to include the semicolon, the compiler will produce an error, indicating the next line as the source of the error. This can cause some confusion, as the statement objected to can be correct, yet as a syntax error is produced.

 

# Variables and the Declaration Statement
A variable is a quantity that is referred to by name, such as “a, b, c, d, and average” in the above program. A variable can take on many values during program execution, but you must make sure that they are given an initial value, as C does not do so automatically. However, before variables can be used in a program, they must be declared in a type declaration statement.

(From OXFORD ENGLISH FOR COMPUTING / TASK 11 / PAGE 45)

 

READING 02 – COMPILING-VS-TRANSPILINGFile

COMPILING VS TRANSPILINGSteve Fenton / 18th November 2012 / Programming

Despite the fact that the term “transpiling” has been around since last century, there appears to be a fair bit of confusion about what it means and what the difference between transpiling and compiling is.

Firstly, transpiling is a specific kind of compiling. This helps a great deal as we now know we are talking about the same kind of thing. It is actually a specific kind of compiling. So how do we define it compared to the more general term?

Compiling is the general term for taking source code written in one language and transforming into another.

Transpiling is a specific term for taking source code written in one language and transforming into another language that has a similar level of abstraction.

So (simplistically) when you compile C#, your method bodies are transformed by the compiler into IL. This cannot be called transpiling because the two languages are very different levels of abstraction.

When you compile TypeScript, it is transformed by the compiler into JavaScript. These are very similar levels of abstraction, so you could call this transpiling.

Both compilers and transpilers can optimise the code as part of the process.

Other common combinations that can be dubbed as transpiling include C++ to C, CoffeeScript to JavaScript, Dart to JavaScript and PHP to C++.

REF: https://www.stevefenton.co.uk/2012/11/compiling-vs-transpiling/

 

READING 03 – PROMPTPAY

PROMPTPAY ‘WILL RESPECT PRIVACY’DATE: 12 Jul 2016
NEWSPAPER SECTION: BUSINESS
WRITER: WICHIT CHANTANUSORNSIRI
BANGKOK POSTAlthough citizens’ ID cards will be linked with bank accounts for the new PromptPay service, personal privacy will be protected, says Finance Minister Apisak Tantivorawong.

Signing up for PromptPay using the 13-digit number is for identification only and financial institutions cannot see other information contained on the card, he said.

The ID card is the clearest way to identify a person because it will not duplicate others, as even name and family name can be redundant, Mr Apisak said.

To quell concerns, he will instruct a legal unit to reconsider the issue thoroughly.

Most of the 15 commercial and four state-owned banks have opened pre-registration for PromptPay, a money transfer and payment service under the national e-payment scheme. Official registration begins on July 15.

Under PromptPay, people can easily and rapidly transfer money online to recipients who hold accounts at different banks, or even the same banks in cross-clearing zones, free of charge, but they are required to sign up to link their ID card or mobile phone number to bank accounts at participating banks.

One registered PromptPay account can be linked to a maximum of four numbers — one ID card and three mobile phone numbers — and these numbers must not be linked to any other account.

All transfers up to 5,000 baht are free; transfers of 5,000 to 30,000 baht are charged a fee of no more than 2 baht; transfers of 30,000 to 100,000 baht cost no more than 5 baht; and transfers exceeding 100,000 baht are charged no more than 10 baht.

The e-payment scheme aims to transform Thailand into a cashless society.

The service will be extended to electronic payments and receiving personal income tax rebates, living allowances for elderly people and other state welfare. Moreover, the system will allow the Revenue Department to plug all e-payment transactions into its data system to boost tax-collecting efficiency.

However, worries over security and personal privacy are discouraging people from PromptPay registration.

Mr Apisak said the Bank of Thailand and banks will take charge of security and the system will involve technology already in place for mobile and internet banking systems.
From http://www.bangkokpost.com/news/general/1033617/promptpay-will-respect-privacy

 

Attendance Quiz

1. The statement float a, b, c, d, average; is a ________ statement.
a. declaration
  b. variable
  c. comment
  d. allocation

 

2. A ________ statement must be used to declare variables.
  a. main
  b. printf
  c. type
  d. compile

 

3. /* CALCULATE AVERAGES */ is a ________ line.
  a. declaration
  b. allocation
  c. variable
  d. comment

 

4. The Function ________ must appear only once in a program.
  a. method
  b. call
  c. main 
  d. procedure

 

5. Each line of any C program must end with a ________ which acts as a statement ________.
  a. function, method
  b. teminator, semicolon
  c. seminator, temicolon
  d. semicolon, teminator

 

6. A quantity referred to by name is known as a ________.
  a. method
  b. declaration
  c. function
  d. variable

 

7. The assignment statements are on lines ________ and ________.
  a. seventh, eighth
  b. fourth, fifth
  c. eighth, ninth
  d. sixth, seventh

 

8. The main part of the program is enclosed within ________.
  a. statement
  b. period
  c. braces
  d. semicolon 

 

9. If you forget to include the correct punctuation, the ________ will produce a ________ error.
  a. compiler, line
  b. compile, execute
  c. compiler, line
  d. compile, line

 

10. The program below contains ________ function statements.
  a. procedure
  b. main
  c. call
  d. method

เฉลย :
1) a. declaration
2) c. type
3) d. comment
4) c. main
5) d. semicolon, teminator
6) d. variable
7) c. eighth, ninth
8) c. braces
9) a. compiler, line
10) b. main

 

Assignment Quiz

1. The program below contains ________ function statements.
a. method
b. main Correct
c. procedure
d. call

 

2. Each line of any C program must end with a ________ which acts as a statement ________.
a. teminator, semicolon
b. function, method
c. semicolon, teminator Correct
d. seminator, temicolon

 

3. From the program,

The assignment statements are on lines ________ and ________.
a. six, seven
b. eight, nine Correct
c. seven, eight
d. four, five

 

4. The statement float a, b, c, d, average; is a ________ statement.
a. declaration Correct
b. comment
c. variable
d. allocation

 

5. /* CALCULATE AVERAGES */ is a ________ line.
a. declaration
b. allocation
c. comment Correct
d. variable

 

6. The main part of the program is enclosed within ________.
a. semicolon
b. statement
c. braces Correct
d. period

 

7. The Function ________ must appear only once in a program.
a. method
b. main Correct
c. procedure
d. call

 

8. A quantity referred to by name is known as a ________.
a. declaration
b. function
c. method
d. variable Correct

 

9. A ________ statement must be used to declare variables.
a. compile
b. printf
c. main
d. type Correct

 

10. If you forget to include the correct punctuation, the ________ will produce a ________ error.
a. compiler, execute
b. compile, line
c. compile, execute
d. compiler, line Correct

เฉลย :
1) b. main
2) c. semicolon, teminator
3) b. eight, nine
4)  a. declaration
5)  c. comment
6)  c. braces
7)  b. main
8)  d. variable
9)  d. type
10) d. compiler, line


เรื่องที่เกี่ยวข้อง

ภาษา English

 

ธมนวรรณ มณีจันทร์

ธมนวรรณ มณีจันทร์

|:- เราเชื่อมั่นว่าการเสียสละและการแบ่งปันจะทำให้โลกใบนี้สวยงามมากขึ้น ทุกๆ จุดเริ่มต้นของการเรียนรู้ นำไปสู่การเรียนรู้ถัดไป เว็บไซต์แห่งนี้ขอเป็นส่วนหนึ่งของการแบ่งปันความรู้ที่ไม่มีที่สิ้นสุด มาร่วมกันผลักดันโลกของเราให้หมุนไปพร้อมกับพลังแห่งความรักด้วยกันนะคะ :) >>> |:- About Me! -:|