1. Trang chủ
  2. » Công Nghệ Thông Tin

ngôn ngữ lập trình c++

38 78 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 38
Dung lượng 502,27 KB

Nội dung

C++ PROGRAMMING LANGUAGE Written by: Phu PHAN Phone: 0905.566.500 Machine Language ● Only language computer directly understands ● Defined by hardware design ○ Machine-dependent ● Generally consist of strings of numbers ○ Ultimately 0s and 1s ● Instruct computers to perform elementary operations ○ One at a time ● Cumbersome for humans ● Example: 1300042774 1400593419 1200274027 Assembly language ● English-like abbreviations representing elementary computer operations ● Clearer to humans ● Incomprehensible to computers ○ Translator programs (assemblers) ■ Convert to machine language ● Example: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY High-level languages ● Similar to everyday English, use common mathematical notations ● Single statements accomplish substantial tasks ○ Assembly language requires many instructions to accomplish simple tasks ● Translator programs (compilers) ○ Convert to machine language ● Interpreter programs ○ Directly execute high-level language programs ● Example: grossPay = basePay + overTimePay C Language ● Evolved from two other programming languages ○ BCPL and B ■ “Typeless” languages ● Dennis Ritchie (Bell Laboratories) ○ Added data typing, other features ● Development language of UNIX ● Hardware independent ○ Portable programs ● 1989: ANSI standard ● 1990: ANSI and ISO standard published ○ ANSI/ISO 9899: 1990 C++ Language ● Extension of C ● Early 1980s: Bjarne Stroustrup (Bell Laboratories) ● Provides capabilities for object-oriented programming ○ Objects: reusable software components ■ Model items in real world ○ Object-oriented programs ■ Easy to understand, correct and modify ● Hybrid language ○ C-like style ○ Object-oriented style ○ Both Java Language ● 1991: Sun Microsystems ○ Green project ● 1995: Sun Microsystems ○ Formally announced Java at trade show ● ● ● ● Web pages with dynamic and interactive content Develop large-scale enterprise applications Enhance functionality of web servers Provide applications for consumer devices ○ Cell phones, pagers, personal digital assistants, … History of Programming Languages Local Environment ● Text Editor ○ Windows: Notepad, Notepad++, Sublime Text… ○ MacOS: TextEdit, Sublime Text… ● C++ Compiler ○ Windows: Dev C++, MS Visual Studio… ○ MacOS: XCode Basic Syntax • Object • Class • Methods • Instance Variables Enumerated Types enum enum-name { list of names } var-list; enum color { red, green, blue } c; c = blue; enum color { red, green = 5, blue }; Variable Types • bool • char • int • float • double • void • wchar_t Variable Definition type variable_list; type variable_name = value; extern int d = 3, f = 5; // declaration of d and f int d = 3, f = 5; // definition and initializing d and f byte z = 22; // definition and initializes z char x = 'x'; // the variable x has the value 'x' Variable Scope • Local Variables • Global Variables Initializing Variables Data Type Initializer int char '\0' float double pointer NULL Defining Constants • #define • const Storage Classes • auto • register • static • extern • mutable Arithmetic Operators ● + ● ● * ● / ● % ● ++ ● Relational Operators • == • != • > • < • >= • > ●

Ngày đăng: 03/05/2019, 04:48

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w