260 likes | 273 Views
This course provides an overview of C programming for non-CSIE majors, teaching the basics of programming and problem-solving using C language. The course covers topics such as selection structures, repetition and loops, modular programming, data types, strings, recursion, file processing, and linked lists.
E N D
Introduction to C Programming計算機程式設計2/22/2012朱浩華
Today’s Do List • Course Overview (20 minutes) • Setup computer accounts • “Hello world!” CodeBlocks program (30 minutes) • Overviews of Computers and Programming (50 minutes)
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)
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 (<stdio.h>) • Linked list
Prerequisite • Good typing skill • Non CSIE major • Read some English
Textbook • Problem Solving and Program Design in C, 6th Edition, Jeri R. Hanly and Eliot B. Koffman
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
Grading (Tentative) • Tentative means that it may be changed later • 33%: 13 assignments • 33%: Midterm exam • 33%: Final exam
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: ?
Means of Communications • Course homepage: http://mll.csie.ntu.edu.tw/course/comp_prog_s12/ • Send email to TA or me • Come to office hours
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
Roster call to see who are hereand how many extra students we can take
Before writing your 1st 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
“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”
Hardware vs. Software • “Hello World” software program executed on the PC hardware
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)
Main memory vs. secondary storage • Main memory: data loss after power loss • Secondary storage (harddisk, flash): no data loss after power loss
What is CPU (Central Processing Unit)? • It executes instructions (e.g., in your program)
Computer Languages • 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