Bài giảng Nhập môn lập trình: Tính toán cơ bản do Võ Quang Hoàng Khang biên soạn với mục tiêu chính như: Hiểu kiểu dữ liệu (data type) là gì, khai báo hằng (constants) và biến (variables) của chương trình. ! | NHẬP MÔN LẬP TRÌNH TÍNH TOÁN CƠ BẢN Variables Expressions NHẬP MÔN LẬP TRÌNH MỤC TIÊU • Hiểu kiểu dữ liệu (data type) là gì • Khai báo hằng (constants) và biến (variables) của chương trình Basic Computations 2 NHẬP MÔN LẬP TRÌNH NỘI DUNG • Biến và kiểu dữ liệu – – – – • Biểu thức – – – – – – Data Types Integral Types Floating-Point Types Declarations Basic Computations Số học Quan hệ Logical Phép gán Mixing Data Types Casting 3 NHẬP MÔN LẬP TRÌNH Review • Computer program: A set of instructions that computer hardware will execute. • Issues for a program/software: Usability, Correctness, Maintainability, Portability • Computer software: A set of related programs • Steps to develop a software: Requirement collecting, Analysis, Design, Implementing, Testing, Deploying, Maintaining • Data: Specific values that describe something • Information: Mean of data • Fundamental Data Units: Bit, Nibble, Byte, KB, MB, GB, TB • Data Representation: Number systems: 2, 10, 8, 16 • Program Instructions: • Programming Languages: Machine language, Assembly, High-level languages Basic Computations 4 NHẬP MÔN LẬP TRÌNH 1- Variables and Data Types Biến là một tên tham chiếu đến một vị trí trong bộ nhớ (address) c Chứa dữ liệu dạng nhị phân Khi chương trình biên dịch, trình biên dịch sẽ xác định vị trí b mà biến được phân bổ. Questions: a (1) Nó ở đâu? It’s Address (2) Nó chiếm bao nhiêu byte nhớ? Data type Basic Computations 0000 1001 1100 .