[PDF] [PDF] PowerPoint Slides for Starting Out With C++ Eearly Objects Eighth

1 3 Programs and Programming Languages CPU – Hardware component that runs programs Includes • Control Unit Chapter 13: Advanced File and I/O



Previous PDF Next PDF





[PDF] Advanced R Programming - Lecture 1

29 août 2017 · Presentation(s) Course Practicals Why R? Basic R Advanced R Programming - Lecture 1 Krzysztof Bartoszek (slides by Leif Jonsson and 



[PDF] PowerPoint Slides for Starting Out With C++ Eearly Objects Eighth

1 3 Programs and Programming Languages CPU – Hardware component that runs programs Includes • Control Unit Chapter 13: Advanced File and I/O



[PDF] Advanced Programming Concepts and Skills - Oracle Help Center

Advanced Programming Concepts and Skills The Design Platform, which is described in the Advanced Programming It is graphical in its presentation



[PDF] Advanced Concepts in Object-Oriented Programming - Harvard SEAS

Lecture 23 — Advanced Concepts in Object-Oriented Programming Dan Grossman Spring 2011 So far The difference between OOP and “records of 



[PDF] Brandon - Advanced Programming Presentation

Advanced Programming in Stata • Programming your own maximum likelihood estimator – Basic syntax – Likelihood functions • Examples: – Normal 



[PDF] SUGI 25: Advanced DATA Step Techniques - SAS

INPUT statement This tutorial focuses on the more advanced techniques that topics/examples covered in this presentation have more than enough details 



[PDF] C Programming Tutorial

If you discover that the tutorialspoint com site or this tutorial Following is the memory presentation of above-defined string in C/C++: Actually, you do not place 



[PDF] LECTURE NOTE on PROGRAMMING IN “C” - VSSUT

C is a programming language developed at AT T's Bell Laboratories of USA advance The body of the loop can be single statement or multiple statements

[PDF] advanced c# tutorial

[PDF] advanced c++ tutorial pdf

[PDF] advanced calculator app for android

[PDF] advanced cisco router configuration pdf

[PDF] advanced complex analysis pdf

[PDF] advanced computational methods in science and engineering pdf

[PDF] advanced concepts in java

[PDF] advanced css book

[PDF] advanced css tutorial with example pdf

[PDF] advanced css3 tutorial pdf free download

[PDF] advanced dance moves ballet

[PDF] advanced db2 sql queries

[PDF] advanced dos commands pdf

[PDF] advanced english class pdf

[PDF] advanced english expressions list

PROGRAMACIÓN EN C++

Transparencias del libro Starting out with C++ : early objects, Tony Gaddis, Judy Walters, GodfreyMuganda

Chapter 1: Introduction to Computers and

Programming

Topics

1.1 Why Program?

1.2 Computer Systems: Hardware and

Software

1.3 Programs and Programming Languages

1.4 What Is a Program Made of?

1.5 Input, Processing, and Output

1.6 The Programming Process

1-3

1.1 Why Program?

Computer-programmable machine designed to

follow instructions

Program/Software-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 1-4

1.2 Computer Systems: Hardware and

Software

Hardware-Physical components of a

computer

Main Hardware Component Categories

1.Central Processing Unit (CPU)

2.Main memory (RAM)

3.Secondary storage devices

4.Input Devices

5.Output Devices

1-5

Main Hardware Component Categories

1-6

Central Processing Unit (CPU)

CPU -Hardware

component that runs programs

Includes

•Control Unit -Retrieves and decodes program instructions -Coordinates computer operations •Arithmetic & Logic Unit (ALU) -Performs mathematical operations 1-7

The CPU's Role in Running a Program

Cycle through:

•Fetch: get the next program instruction from main memory •Decode: interpret the instruction and generate a signal •Execute: route the signal to the appropriate component to perform an operation 1-8

Main Memory

•Holds both program instructions and data •Volatile -erased when program terminates or computer is turned off •Also called Random Access Memory (RAM) 1-9

Main Memory Organization

•Bit -Smallest piece of memory -Stands for binary digit -Has values 0 (off) or 1 (on) •Byte -Is 8 consecutive bits -Has an address •Word -Usually 4 consecutive bytes 1-10

0 1 1 0 0 1 1 1

8 bits

1 byte

Secondary Storage

•Non-volatile -data retained when program is not running or computer is turned off •Comes in a variety of media -magnetic: floppy or hard disk drive, internal or external -optical: CD or DVD drive -flash: USB flash drive 1-11

Input Devices

•Used to send information to the computer from outside •Many devices can provide input -keyboard, mouse, microphone, scanner, digital camera, disk drive, CD/DVD drive,

USB flash drive

1-12

Output Devices

•Used to send information from the computer to the outside •Many devices can be used for output -Computer screen, printer, speakers, disk drive, CD/DVD recorder, USB flash drive 1-13

Software Programs That Run on a

Computer

•System software -programs that manage the computer hardware and the programs that run on the computer -Operating Systems •Controls operation of computer •Manages connected devices •Runs programs -Utility Programs •Support programs that enhance computer operations •Examples: anti-virus software, data backup, data compression -Softwaredevelopment tools •Used by programmers to create software •Examples: compilers, integrated development environments (IDEs) 1-14

1.3 Programs and Programming

Languages

•Program a set of instructions directing a computer to perform a task •Programming Language a language used to write programs 1-15

Algorithm

Algorithm:

a set of steps to perform a task or to solve a problem

Order is important. Steps must be

performed sequentially 1-16

Programs and Programming Languages

Types of languages

-Low-level: used for communication with computer hardware directly. -High-level: closer to human language 1-17

From a High-level Program to an

Executable File

a)Create file containing the program with a text editor. b)Run preprocessorto convert source file directives to source code program statements. c)Run compilerto convert source program statements into machine instructions. 1-18

From a High-level Program to an

Executable File

d)Run linkerto connect hardware-specific library code to machine instructions, producing an executable file.

Steps b) through d) are often performed by a

single command or button click.

Errors occuring at any step will prevent

execution of the following steps. 1-19

From a High-level Program to an

Executable File

1-20

1.4 What Is a Program Made Of?

Common elements in programming

languages: -Key Words -Programmer-Defined Identifiers -Operators -Punctuation -Syntax 1-21

Example Program

#include using namespace std; int main() double num1 = 5, num2, sum; num2 = 12; sum = num1 + num2; cout << "The sum is " << sum; return 0; 1-22

Key Words

•Also known as reserved words •Have a special meaning in C++ •Can not be used for another purpose •Written using lowercase letters •Examples in program (shown in green): using namespace std; int main() 1-23

Programmer-Defined Identifiers

•Names made up by the programmer •Not part of the C++ language •Used to represent various things, such as variables (memory locations) •Example in program (shown in green): double num1 1-24

Operators

•Used to perform operations on data •Many types of operators -Arithmetic: +, -, *, / -Assignment: = •Examples in program(shown in green): num2 = 12; sum = num1+ num2; 1-25

Punctuation

•Characters that mark the end of a statement, or that separate items in a list •Example in program (shown in green): double num1 = 5, num2 , sum; num2 = 12; 1-26

Lines vs. Statements

In a source file,

A line

is all of the characters entered before a carriage return.

Blank lines improve the readability of a

program.

Here are four sample lines. Line 3 is blank:

1. double num1 = 5, num2, sum;

2. num2 = 12;

3.

4. sum = num1 + num2;

1-27

Lines vs. Statements

In a source file,

A statement is an instruction to the computer to

perform an action.

A statement may contain keywords, operators,

programmer -defined identifiers, and punctuation.

A statement may fit on one line, or it may

occupy multiple lines.

Here is a single statement that uses two lines:

double num1 = 5, num2, sum; 1-28

Variables

•A variable is a named location in computer memory (in RAM) •It holds a piece of data. The data that it holds may change while the program is running. •The name of the variable should reflect its purpose •It must be definedbefore it can be used. Variable definitions indicate the variable name and the type of data that it can hold. •Example variable definition: double num1; 1-29

1.5 Input, Processing, and Output

Three steps that many programs perform

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 or a printer -write it to a file 1-30

1.6 The Programming Process

1.Define what the program is to do.

2.Visualize the program running on the

computer.

3.Use design tools to create a model of the program.

Hierarchy charts, flowcharts, pseudocode, etc.

4.Check the model for logical errors.

5.Write the program source code.

6.Compile the source code.

1-31

The Programming Process (cont.)

7. Correct any errors found during compilation.

8. Link the program to create an executable file.

9. Run the program using test data for input.

10. Correct any errors found while running the

program.

Repeat steps 4 -10 as many times as necessary.

11. Validate the results of the program.

Does the program do what was defined in step 1?

1-32

Chapter 2: Introduction to C++

Topics

2.1 The Parts of a C++ Program

2.2 The

coutObject

2.3 The

#includeDirective

2.4 Standard and Prestandard C++

2.5 Variables, Literals, and the Assignment

Statement

2.6 Identifiers

2.7 Integer Data Types

2.8 Floating

-Point Data Types 2-34

Topics (continued)

2.9 The char Data Type

2.10 The C++

stringClass

2.11 The

boolData Type

2.12 Determining the Size of a Data Type

2.13 More on Variable Assignments and

Initialization

2.14 Scope

2.15 Arithmetic Operators

2.16 Comments

2-35

2.1 The Parts of a C++ Program

// sample C++ program #include using namespace std; int main() cout << "Hello, there!"; return 0; 2-36 comment preprocessor directive which namespace to use beginning of function named main beginning of block formain output statement send 0back to operating system end of block for main

2.1 The Parts of a C++ Program

2-37

StatementPurpose

// sample C++ program comment #include preprocessor directive using namespace std; which namespace to use intmain()beginning of functionnamed main beginning of block for main cout<< "Hello, there!";output statement return 0; send 0 back to the operating system end of block for main

Special Characters

2-38

CharacterNameDescription

Double SlashBegins a comment

Pound SignBegins preprocessor directive

Open, Close BracketsEncloses filename used in

#includedirective

Open, Close ParenthesesUsed when naming function

Open, Close BracesEncloses a group of statements

Open, Close Quote MarksEncloses string of characters

SemicolonEnds a programming statement

Important Details

•C++ is case-sensitive. Uppercase and lowercase characters are different characters. 'Main' is not the same as 'main'. •Every {must have a corresponding }, and vice-versa. 2-39

2.2 The coutObject

•Displays information on computer screen •Use <Starting a New Line •To get multiple lines of output on screen -Use endl cout << "Hello, there!" << endl; -Use \nin an output string cout << "Hello, there! \n"; 2-41

Escape Sequences -More Control Over

Output

2-42

2.3 The #includeDirective

•Inserts the contents of another file into the program •Is a preprocessor directive -Not part of the C++ language -Not seen by compiler •Example: #include 2-43

No ;goes here

2.4 Standard and Prestandard C++

Prestandard (Older-style) C++ programs

•Use .hat end of header files #include •Do not use using namespaceconvention •May not use return 0; at the end of function main •May not compile with a standard C++ compiler 2-44

2.5 Variables, Literals, and the

Assignment Statement

•Variable -Has a name and a type of data it can holdquotesdbs_dbs14.pdfusesText_20