IGCSE Edexcel Computer Science: Programming Basics | IGCSE Edexcel 计算机:编程基础考点精讲

📚 IGCSE Edexcel Computer Science: Programming Basics | IGCSE Edexcel 计算机:编程基础考点精讲

Programming is the core skill of creating software. In IGCSE Computer Science, you design solutions using pseudocode and then write code in a high-level language like Python. This guide covers all essential programming basics required by the Edexcel syllabus, from variables and control structures to data structures and debugging.

编程是创建软件的核心技能。在IGCSE计算机科学中,你将使用伪代码设计解决方案,然后用Python等高级语言编写代码。本指南涵盖Edexcel教学大纲要求的所有基本编程基础,从变量和控制结构到数据结构和调试。


1. Introduction to Programming | 编程简介

Programming means writing a set of instructions that a computer can follow to solve a problem. A program is a sequence of such instructions. An algorithm is a step-by-step plan that must be clear, precise, and finite. Programmers use three fundamental constructs: sequence (executing statements in order), selection (making decisions), and iteration (repeating code).

编程意味着编写计算机可遵循以解决问题的一组指令。程序就是这种指令序列。算法是一步一步的计划,必须清晰、精确且有限。程序员使用三种基本结构:顺序(按顺序执行语句)、选择(做出决策)和迭代(重复代码)。

Decomposition is breaking a complex problem into smaller, manageable parts. Before coding, you should plan using flowcharts or pseudocode. A flowchart uses symbols like rectangles, diamonds, and arrows to represent steps and decisions. Pseudocode is a human-readable way to describe an algorithm using structured English.

分解是将复杂问题分解为更小、可管理的部分。在编码前,应使用流程图或伪代码进行规划。流程图使用矩形、菱形和箭头等符号表示步骤和决策。伪代码是一种使用结构化英语描述算法的可读方式。

Throughout the IGCSE course, you will be expected to write and interpret pseudocode and translate it into a working program. Understanding the basics of input, output, storage, and processing is essential for success.

在整个IGCSE课程中,你需要编写和解释伪代码,并将其转换为可运行的程序。理解输入、输出、存储和处理的基础知识对于取得成功至关重要。


2. Variables, Data Types & Constants | 变量、数据类型与常量

Variables are named storage locations that hold data which can change while a program runs. In pseudocode, you declare a variable with a statement such as DECLARE age AS INTEGER or simply use the assignment operator: score ← 0. Variable names should be meaningful and follow the naming conventions of the language.

变量是命名的存储位置,存放的数据在程序运行时可改变。在伪代码中,用诸如 DECLARE age AS INTEGER 的语句声明变量,或直接用赋值运算符:score ← 0。变量名应有意义并遵循语言的命名规范。

The IGCSE syllabus requires you to understand these data types:

IGCSE大纲要求你理解以下数据类型:

INTEGER stores whole numbers, such as 5, -3, 0.

INTEGER 存储整数,例如5、-3、0。

REAL stores numbers with a fractional part, sometimes called float; e.g., 3.14, -0.5.

REAL 存储带小数部分的数字,有时称为浮点数;例如3.14、-0.5。

CHARACTER (CHAR) stores a single letter, digit, or symbol like ‘A’, ‘9’, ‘%’.

CHARACTER (CHAR) 存储单个字母、数字或符号,如 ‘A’、’9’、’%’。

STRING stores a sequence of characters, e.g., “Hello2024!”. Strings can be indexed.

STRING 存储字符序列,例如 “Hello2024!”。字符串可索引。

BOOLEAN stores only two values: TRUE or FALSE. Essential for conditions.

BOOLEAN 仅存储两个值:TRUE 或 FALSE。对条件判断至关重要。

Constants are similar to variables but their value is fixed throughout the program. Use the keyword CONSTANT, for example: CONSTANT PI ← 3.14159. Constants improve readability and make programs easier to update.

常量类似于变量,但其值在整个程序中固定不变。使用关键字 CONSTANT,例如:CONSTANT PI ← 3.14159。常量提高可读性,并使程序更易更新。


3. Input and Output | 输入与输出

Programs need to communicate with the user. INPUT statements read data from the keyboard and store it into a variable. In pseudocode, the typical command is INPUT variableName. For instance, INPUT name reads a string and stores it in name.

程序需要与用户通信。INPUT 语句从键盘读取数据并存储到变量中。伪代码中,典型命令是 INPUT variableName。例如,INPUT name 读取字符串并存储于 name。

Sometimes the input is converted to a specific type, e.g., age ← INTEGER(INPUT()). In Python, you use int(input()) to cast the input to an integer.

有时输入会转换为特定类型,例如 age ← INTEGER(INPUT())。在Python中,使用 int(input()) 将输入转换为整数。

OUTPUT statements display information on the screen. Pseudocode uses OUTPUT “hello”, or OUTPUT variable. You can output multiple items by separating them with commas. For example, OUTPUT “Total is “, total, ” pounds”.

OUTPUT 语句在屏幕上显示信息。伪代码使用 OUTPUT “hello” 或 OUTPUT variable。你可以用逗号分隔多个项来输出。例如 OUTPUT “Total is “, total, ” pounds”。

Formatting output makes it more user-friendly. In Python, you can use f-strings: print(f”Hello {name}”). In pseudocode, you might see OUTPUT “Result: ” + result.

格式化输出使其更友好。在Python中,可使用f-string:print(f”Hello {name}”)。伪代码中可能会看到 OUTPUT “Result: ” + result。


4. Assignment and Arithmetic Operations | 赋值与算术运算

Assignment sets or updates a variable’s value. The pseudocode operator is an arrow (←). The right side is calculated first, then the result is stored in the left-side variable. For example: x ← 10, y ← x + 5.

赋值设置或更新变量的值。伪代码运算符是箭头(←)。先计算右侧,然后将结果存储到左侧变量。例如:x ← 10,y ← x + 5。

Common arithmetic operators: + (addition), – (subtraction),

Published by TutorHao | IGCSE Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading