Download presentation
Presentation is loading. Please wait.
Published byGeraldine Hamilton Modified over 9 years ago
1
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 컴퓨터와 프로그래밍에 대한 소개
2
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 2 © 2006 Pearson Education. All Rights Reserved Topics 1.1 프로그래밍을 하는 이유 ? 1.2 컴퓨터시스템 : 하드웨어와 소프트웨어 1.3 프로그램과 프로그래밍 언어 1.4 프로그램의 구성 1.5 입력, 처리, 출력 1.6 프로그래밍 과정 1.7 절차적 프로그래밍과 객체 지향 프로그래밍
3
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 3 © 2006 Pearson Education. All Rights Reserved 1.1 프로그래밍을 하는 이유 ? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer – person who writes instructions (programs) to make computer perform a task SO, without programmers, no programs; without programs, the computer cannot do anything
4
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 4 © 2006 Pearson Education. All Rights Reserved 1.2 컴퓨터시스템 : 하드웨어와 소프트웨어 하드웨어 1. 중앙처리장치 (Central Processing Unit) 2. 메인 메모리 (Main Memory) 3. 보조기억장치 (Secondary Memory / Storage) 4. 입력장치 (Input Devices) 5. 출력장치 (Output Devices)
5
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 5 © 2006 Pearson Education. All Rights Reserved 하드웨어 구성 Input Device Output Device Secondary Storage Devices Central Processing Unit Main Memory
6
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 6 © 2006 Pearson Education. All Rights Reserved 중앙처리장치 (CPU) Includes 제어장치 (Control Unit) –Retrieves and decodes program instructions –Coordinates computer operations 산술, 논리 연산장치 (Arithmetic & Logic Unit:ALU) –Performs mathematical operations
7
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 7 © 2006 Pearson Education. All Rights Reserved 메인 메모리 (Main Memory) Holds both program instructions and data Volatile – erased when program terminates or computer is turned off Also called Random Access Memory (RAM)
8
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 8 © 2006 Pearson Education. All Rights Reserved 메인 메모리 구성 비트 (Bit) –Smallest piece of memory –Stands for binary digit –Has values 0 (off, false) or 1 (on, true) 바이트 (Byte) –Is 8 consecutive bits –Bytes have addresses –A byte can hold one character 0 1 1 0 0 1 1 1 8 bits1 byte
9
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 9 © 2006 Pearson Education. All Rights Reserved 보조기억장치 (Secondary Storage) 비휘발성 (Non-volatile) - data retained when program is not running or computer is turned off Comes in a variety of media –magnetic: floppy disk, zip disk, hard drive –optical: CD
10
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 10 © 2006 Pearson Education. All Rights Reserved 입력장치 (Input Devices) Used to send information to the computer from outside Many devices can provide input –keyboard, mouse, scanner, digital camera, disk drive, CD drive
11
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 11 © 2006 Pearson Education. All Rights Reserved 출력장치 (Output Devices ) Used to send information from the computer to the outside Many devices can be used for output –Computer monitor, printer, disk drive, writable CD drive
12
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 12 © 2006 Pearson Education. All Rights Reserved 소프트웨어 운영체제 (Operating system software) –programs that manage the computer hardware and the programs that run on them Ex: Windows, UNIX, Linux 응용 소프트웨어 (Application software) –programs that provide services to the user. Ex: word processing, games, programs to solve specific problems
13
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 13 © 2006 Pearson Education. All Rights Reserved 1.3 프로그램과 프로그래밍 언어 프로그램 (Program) a set of instructions directing a computer to perform a task 프로그래밍 언어 (Programming Language) a language used to write programs
14
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 14 © 2006 Pearson Education. All Rights Reserved 프로그램과 프로그래밍 언어 프로그래밍 언어의 부류 – 저급언어 (Low-level): used for communication with computer hardware directly. Often written in binary machine code (0’s/1’s). – 고급언어 (High-level): closer to human language Ex. 표 1-1(page 10)
15
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 15 © 2006 Pearson Education. All Rights Reserved 고급언어 실행가능한 형태로의 번역 a)Create file containing the program with a text editor. b)Run preprocessor( 전처리기 ) to convert source file directives to source code program statements. c)Run compiler( 컴파일러 ) to convert source program statements into machine instructions.
16
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 16 © 2006 Pearson Education. All Rights Reserved 고급언어 실행가능한 형태로의 번역 d)Run linker( 링크 ) to connect hardware- specific code to machine instructions, producing an executable file. Steps b)–d) are often performed by a single command or button click. Errors detected at any step will prevent execution of the following steps.
17
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 17 © 2006 Pearson Education. All Rights Reserved 고급언어 실행가능한 형태로의 번역 Object Code Linker Executable Code Source Code Preprocessor Modified Source Code Compiler
18
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 18 © 2006 Pearson Education. All Rights Reserved 1.4 프로그램의 구성 프로그래밍 언어의 공통적인 요소 – 키위드 (Key Words) – 프로그래머 정의 식별자 (Programmer- Defined Identifier) – 연산자 (Operators) – 구둣점 (Punctuation) – 구문 (Syntax)
19
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 19 © 2006 Pearson Education. All Rights Reserved 예 프로그램 #include using namespace std; int main() { string name; cout << "What is your name? "; cin >> name; cout << "Hello there, " << name; return 0; }
20
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 20 © 2006 Pearson Education. All Rights Reserved 키워드 Also known as reserved words( 예약어 ) Have a special meaning in C++ Can not be used for another purpose 예 (shown in green) : using namespace std; int main()
21
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 21 © 2006 Pearson Education. All Rights Reserved 프로그래머 정의 식별자 Names made up by the programmer Not part of the C++ language Used to represent various things – 변수 ( variables:memory locations), 함수 (functions), etc. 예 (shown in green) : string name;
22
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 22 © 2006 Pearson Education. All Rights Reserved 연산자 Used to perform operations on data Many types of operators –Arithmetic: +, -, *, / –Assignment: = 예 (shown in green) : cout << "What is your name? "; cin >> name;
23
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 23 © 2006 Pearson Education. All Rights Reserved 구둣점 Characters that mark the end of a statement, or that separate items in a list 예 (shown in green) : string name ; cin >> name ;
24
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 24 © 2006 Pearson Education. All Rights Reserved 구문 The rules of grammar that must be followed when writing a program Controls the use of key words, operators, programmer-defined symbols, and punctuation
25
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 25 © 2006 Pearson Education. All Rights Reserved 변수 (Variable) A named location in the computer (in RAM) Holds a piece of data Must be defined before it can be used 예 ( 변수 정의 ): - string name;
26
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 26 © 2006 Pearson Education. All Rights Reserved 1.5 입력, 처리, 출력 3 단계 1)Gather input data -from keyboard -from files on disk drives 2)Process the input data 3)Display the results as output -send it to the screen -write to a file
27
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 27 © 2006 Pearson Education. All Rights Reserved 1.6 프로그래밍 과정 1. 프로그램이 무엇을 할 것인지 정의한다. 2. 프로그램이 컴퓨터 상에서 실행되는 모습을 실제로 그린다. 3. 디자인 도구를 사용하여 프로그램의 모델을 만든다. 계층차트, 의사코드, 순서도 등 4. 작성된 모델의 논리 오류를 확인한다. 5. 프로그램의 소스코드를 작성한다. 6. 소스코드를 컴파일한다.
28
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 28 © 2006 Pearson Education. All Rights Reserved 프로그래밍 과정 7. 컴파일 중에 발견된 모든 오류를 수정한다. 8. 실행 파일을 만들기 위해 프로그램을 링크한다. 9. 테스트 입력자료를 사용하여 프로그램을 실행한다. 10. 프로그램 실행 중에 발견된 모든 오류를 수정한다. 필요하다면 단계 4 – 10 을 반복한다. 11. 프로그램 결과를 검증한다.
29
Chapter 1 Starting Out with C++: Early Objects 5/e Slide 29 © 2006 Pearson Education. All Rights Reserved 1.7 절차적 프로그래밍과 객체 지향 프로그래밍 절차적 프로그래밍 ( Procedural programming) –Focus is on the process –Procedures/functions are written to process data 객체 지향 프로그래밍 (Object-Oriented programming) –Focus is on objects, which contain data and the means to manipulate the data –Messages are sent to objects to perform operations
30
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction to Computers and Programming
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.