25
1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich [email protected]

1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich [email protected]

Embed Size (px)

Citation preview

Page 1: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

1

CS1430: Programming in C++

Section 2

Instructor: Qi Yang

213 Ullrich

[email protected]

Page 2: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

2

Class Materials

CS1430 Course Files https://xray.ion.uwplatt.edu/files/

S:\Courses\CSSE\CourseFiles\CS1430

My Home Page: http://www.uwplatt.edu/~yangq/

Notes, Quizzes, Tests

Page 3: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

3

CS143: Course Outcomes

Upon completion of this course, students should be able to:

• Develop algorithms to solve "computer-solvable" problems. • Test algorithms. • Translate algorithms to C++ programs. • Debug, run and test C++ "procedural" programs. • Understand the software development process by using

requirements to design, implement and test C++ programs.

Page 4: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

4

No Prerequisite

• Any one can take CS143

• Not any one can pass CS143

• D/F rate: 25-40%

• Recommendation:– Previous programming experience

such as CS 1130– (Math)– (English)

Page 5: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

5

Course Work

11 Labs (drop lowest) 50

6 Programs 120

Quizzes/Assignments 50

3 Tests 180

Final 100

Total 500

Page 6: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

6

Grading

450 – 500 A400 – 449 B350 – 399 C300 – 349 DBelow 300 F

NO CURVE!

Page 7: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

7

Grading

Each Program is REQUIRED

Pass each program or FAIL CS143

Start Early!

Page 8: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

8

Tentative Test Schedule

• Test 1: Friday of Week 5

• Test 2: Friday of Week 9

• Test 3: Friday of Week 14

Page 9: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

9

Notes

• Check UWP email every day• Go to my Web site to get notes and some quizzes• Go to the class Web site to get programs• Go to S:\Academic\CSSE\CS\CS143 to get labs• Copy your files to S:\Courses\CSSE\yangq\

CS1430 before coming for questions

Page 10: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

10

Good Luck!

• Come to classes/labs Surprise quizzes?• Do the work by yourself• Get Help

Page 11: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

11

What is a computer?

Input Output

Storage

Network

CPU

MEMORY

Page 12: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

12

Hardware

• CPU

• Memory

• Keyboard

• Monitor

• Disk

• …

Page 13: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

13

How to Store Data in Computer

Bit

Byte

Electronic DeviceOn / OffValue: 1 / 0

8 bitsPossible combinations 256 28

Page 14: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

14

How to Store Data in Computer

27 + 23 + 22 + 21 + 20 128 + 8 + 4 + 2 + 1

Decimal Number: 143

1 0 0 0 1 1 1 1

27 26 25 24 23 22 21 20

Binary Number

Page 15: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

15

How to Store Data in Computer

0 1 0 0 0 0 0 1

Binary Number

65

Character

ASCII

‘A’

(EBCDIC)

Page 16: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

16

ASCII Code Table

‘C’: 67 ‘0’: 48

0 1 2 3 4 5 6 7 8 9

4 0 1

5 2 3 4 5 6 7 8 9

6 A B C D E

7 F G H I J K L M N O

8 P Q R S T U V W X Y

9 Z a b c

10 d e f

Page 17: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

17

How to Store Data in Computer

Word 2 bytes (16 bits)

Integers Binary NumbersCharacters ASCII UnicodeFloat Numbers?Negative numbers?

Double Word 4 bytes (32 bits)

Page 18: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

18

How to Store Data in ComputerKB 1024 Bytes 210

MB 1024 * 1024 Bytes 220

TB…

GB 1024 * 1024 * 1024 Bytes 230

Page 19: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

19

Software: Programs

• What is a Computer Program?

A sequence of statements in a programming language.

• High Level Programming Language

• Low Level Programming Language

Page 20: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

20

High Level Programming Languages

C++

Java

Basic

Cobol

English Like

Easy to Read and Write

(Compared with low level)

C++ Code ExampleTotal = Total + Score;

Page 21: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

21

Low Level Programming Languages

Total = Total + Score;

Machine Code10010110 00000000 10100101

Assembly CodeAdd AX, Score

Page 22: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

22

Programming Steps

• Create source code file: Lab0.cpp

• Compile to machine code: Lab0.obj

• Link to executable program: Lab0.exe

• Run Lab0.exe

Page 23: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

23

HiC

• C++ compiler

• Development Environment

• No *.obj or *.exe files

Page 24: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

24

Problem Solving

• Solve the problem before writing any program

• Pseudo Code

If score is positive

Add score to Total

Else

Display a message

Page 25: 1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich YangQ@uwplatt.edu

25

Quiz1-1

• 1 point

• Due Beginning of Class on Wednesday