Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Introduction to C Programming 計算機程式設計 2/22/2012 朱浩華.

Similar presentations


Presentation on theme: "1 Introduction to C Programming 計算機程式設計 2/22/2012 朱浩華."— Presentation transcript:

1 1 Introduction to C Programming 計算機程式設計 2/22/2012 朱浩華

2 Today’s Do List Course Overview (20 minutes) Setup computer accounts “Hello world!” CodeBlocks program (30 minutes) Overviews of Computers and Programming (50 minutes) 2

3 Course Goals First course in programming language for non-CSIE majors Learning Learn how to become a good C programmer –Able to use the programming skill to solve problems in your fields of studies. Computer language is a lot simpler than natural language such as Chinese (because machines are dump) –Limited vocabulary (< 100 constructs) –Simple grammar (plural, singular, …) –No ambiguity (e.g., present the present) 3

4 Course Topics Cover as much as C programming as possible (adjust based on progress) –Basics –Selection structures (if-else, switch) –Repetition and Loop (for, while, do) –Modular programming & pointers –Simple and Complex Data types (arrays) –Strings –Recursion –Structure and Union Types –File processing ( ) –Linked list 4

5 Prerequisite Good typing skill Non CSIE major Read some English 5

6 Textbook Problem Solving and Program Design in C, 6 th Edition, Jeri R. Hanly and Eliot B. Koffman 6

7 Course Format Weekly take-home programming assignments (13) Midterm exam –Fixed date 4/25/2012 in class –Offer once only Final exam –Fixed date: 6/20/2012 in class –Offer once only 7

8 Grading (Tentative) Tentative means that it may be changed later 33%: 13 assignments 33%: Midterm exam 33%: Final exam 8

9 Teaching Staff Instructor: –“Hao” Chu ( 朱浩華 ) –hchu@csie.ntu.edu.tw –Office: CSIE 518 –Weekly office hours: Thu 2-3:30 pm TA: –TimeString ( 何柏樟 ) – the master programmer –timestringalpha@gmail.com –Office: CSIE 336 –Weekly office hours: ? 9

10 Means of Communications Course homepage: http://mll.csie.ntu.edu.tw/course/comp_prog_s12/ http://mll.csie.ntu.edu.tw/course/comp_prog_s12/ Send email to TA or me Come to office hours 10

11 Lecture Notes Available on the course homepage prior to each lecture –Complement, not replacement for attending lecture –We will do plenty of programming practices during classes 11

12 12 Roster call to see who are here and how many extra students we can take

13 13 Questions on the Administrative Things?

14 Before writing your 1 st program Hand out computer accounts What is a program? –A sequence of instructions that the computer executes –What is and isn’t a program? Will use CodeBlocks to write programs. –IDE (Integrated Development Environment) –A program that makes it easy for you to write programs –Actually contains many programs A word processor: like MS Words A compiler: translate your text program into machine-executable code A debugger: test the correctness of a program 14

15 “Hello World” with CodeBlocks Make sure your computer has CodeBlocks installed Switch to programming screen –Create a new project called “helloworld” –Type in the “Hello World” program –Click on Build -> “Build and run” 15

16 16 Overview of Computers and Programs Chapter 1

17 Computer Hardware 17

18 PC Motherboard 18

19 Hardware vs. Software “Hello World” software program executed on the PC hardware 19

20 A bit of Hardware - memory What is memory? –Consists of memory cells – like a pill box –Each memory cell stores content or data (0s and 1s) –Each memory cell has an address (like the day) Bits and Bytes –A bit stores one binary digits (0 or 1). –A byte = 8 bits (one char, like A) 20

21 1-21 How big is 4GB (Gigabyte)? 4 * 10 9 bytes

22 Memory storage units 22 TermAbbrev.Equivalent toComparison to Power of 10 Bitb ByteB8 bits KilobyteKB1024 (2 10 ) bytes> 10 3 MegabyteMB1,048,576 (2 20 ) bytes > 10 6 GigabyteGB1,073,741,824 (2 30 ) bytes > 10 9 TerabyteTB1,099,511,627,776 (2 40 ) bytes > 10 12 googol10 100

23 Main memory vs. secondary storage Main memory: data loss after power loss Secondary storage (harddisk, flash): no data loss after power loss 23

24 Directory vs. file 24

25 What is CPU (Central Processing Unit)? 25 It executes instructions (e.g., in your program)

26 Computer Languages 26 High-level languages –More like English, easier to program –C, Java, Objective-C, … Machine language –Made up of 0/1s, not easy to read Compiler (the build command in CodeBlocks) –Translate high-level language to machine language


Download ppt "1 Introduction to C Programming 計算機程式設計 2/22/2012 朱浩華."

Similar presentations


Ads by Google