210 likes | 417 Views
16.216 ECE Application Programming. Instructor: Dr. Michael Geiger Fall 2014 Lecture 1: Course overview Basic C program structure. Lecture outline. Course overview Instructor information Course materials Course policies Resources Course outline Introduction to C programming
E N D
16.216ECE Application Programming Instructor: Dr. Michael Geiger Fall 2014 Lecture 1: Course overview Basic C program structure
Lecture outline • Course overview • Instructor information • Course materials • Course policies • Resources • Course outline • Introduction to C programming • Program development cycle • Development environments • Basic program structure ECE Application Programming: Lecture 1
Course staff & meeting times • Lectures: • MWF 12-12:50, Ball 210 • Instructor: Dr. Michael Geiger • E-mail: Michael_Geiger@uml.edu • Phone: 978-934-3618 (x43618 on campus) • Office: 118A Perry Hall • Office hours: M 1-2:30, W 1-2:30, Th 3-4:30 • Student questions are top priority during these hours • Also available MWF 9-11:45 and Th 4:30-6:15, or by appointment at other times • Poll on website to schedule “supervised programming hours”—hold some office hours in classroom ECE Application Programming: Lecture 1
Course materials • Textbook: K.N. King, C Programming: A Modern Approach, 2nd edition, 2008, W.W. Norton. • ISBN: 978-0-393-97950-3 • Course tools:Will need access to C compiler • Windows • Microsoft Visual Studio Express (MS website) • Full Visual Studio free at www.dreamspark.com • Mac • Xcode (Mac App Store) • Linux • gcc/gdb(text-based; can run through terminal on Mac as well) • All platforms: NetBeans • In engineering labs • Requires another compiler to be installed (Xcode for Mac; Cygwin/gcc for Windows) ECE Application Programming: Lecture 1
Additional course materials • Course websites: http://mgeiger.eng.uml.edu/16216/f14/index.htm http://mgeiger.eng.uml.edu/16216/f14/schedule.htm • Will contain lecture slides, handouts, assignments • Discussion group through piazza.com: • Allow common questions to be answered for everyone • All course announcements will be posted here • Will use as class mailing list—please enroll ASAP ECE Application Programming: Lecture 1
Course policies • Prerequisite: 25.107 (Intro to Engineering II), ECE major • Academic honesty • All assignments are to be done individually unless explicitly specified otherwise by the instructor • Any copied solutions, whether from another student or an outside source, are subject to penalty • You may discuss general topics or help one another with specific errors, but do not share assignment solutions • Must acknowledge assistance from classmate in submission ECE Application Programming: Lecture 1
Programming assignments • Will submit all code via e-mail to Dr. Geiger • Will not get confirmation unless you explicitly ask • Penalty after due date: -(2n-1) points per day • i.e., -1 after 1 day, -2 after 2 days, -4 after 3 days … • Assignments that are 8+ days late receive 0 • See grading policies (last three pages of today’s handout) for more details on: • Grading rubric • Common deductions • Regrade policy • Example grading ECE Application Programming: Lecture 1
Programming assignments: regrades • You are allowed one penalty-free resubmission per assignment • Each regrade after the first: 1 day late penalty • Must resubmit by regrade deadline, or late penalties will apply • Late penalty still applies if original submission late • “Original submission” first file submitted containing significant amount of relevant code • In other words, don’t turn in a virtually empty file just to avoid late penalties—it won’t count ECE Application Programming: Lecture 1
Grading and exam dates • Grading breakdown • Programming assignments: 60% • Exam 1: 10% • Exam 2: 15% • Exam 3: 15% • Exam dates • Exam 1: Wednesday, October 1 in class • Exam 2: Wednesday, November 5 in class • Exam 3: TBD (during finals) ECE Application Programming: Lecture 1
Tentative course outline • Basic C program structure and development • Working with data: data types, variables, operators, expressions • Basic console input/output • Control flow • Functions: basic modular programming, argument passing • Pointers, arrays, and strings • File & general input/output • Bitwise operators • Creating new data types: structures • Dynamic memory allocation ECE Application Programming: Lecture 1
Programming exercises • Note on course schedule: several days marked as “PE#” • Those classes will contain supervised, in-class programming exercises • We’ll write/complete short programs to illustrate previously covered concepts • If you have a laptop, bring it • May have to do some design ahead of time ... ECE Application Programming: Lecture 1
Program development • ... which is a good approach for your assignments, too! • Average student’s approach to programming • Read specification (assignment) • ... at least some of it, anyway ... • Attempt to write complete program • Find output error and fix related code • Repeat previous step until either • Code completely works ... • ... or code is such a mess that problem(s) can’t be fixed ECE Application Programming: Lecture 1
Program development (cont.) • A more structured approach to program development • Read specification • Identify requirements • What results should program produce? • How can I test correctness of those results? • Plan design that implements requirements • Using flowchart, pseudocode, etc. • Plan for tests as well • Translate design into actual code • Test program and fix errors ECE Application Programming: Lecture 1
Our first C program #include <stdio.h>int main(){ printf("Hello World!\n"); return 0;} ECE Application Programming: Lecture 1
Our first C program # indicates pre-processor directive include is the directive stdio.h is the name of the file to "insert" into our program. The <> means it is part of the C development system #include <stdio.h>int main(){ printf("Hello World!\n"); return 0;} ECE Application Programming: Lecture 1
Our first C program main is the name of the primary (or main) procedure. All ANSI C programs must have a main routine named main The () indicates that main is the name of a procedure. All procedure references must be followed with () #include <stdio.h>int main(){ printf("Hello World!\n"); return 0;} ECE Application Programming: Lecture 1
Our first C program { } enclose a "block". A block is zero or more C statements. Note that code inside a block is typically indented for readability—knowing what code is inside the current block is quite useful. #include <stdio.h>int main(){ printf("Hello World!\n"); return 0;} ECE Application Programming: Lecture 1
Our first C program printf() is a "built-in" function (which is actually defined in stdio.h). "Hello World!" is the string to print. More formally, this is called the control string or control specifier. #include <stdio.h>int main(){ printf("Hello World!\n"); return 0;} Every statement must end with a ";". Preprocessing directives do not end with a ";" (but must end with a return). ECE Application Programming: Lecture 1
Our first C program The \n is an escape character used by the printf function; inserting this character in the control string causes a “newline” to be printed—it’s as if you hit the “Enter” key #include <stdio.h>int main(){ printf("Hello World!\n"); return 0;} ECE Application Programming: Lecture 1
Our first C program The int tells the compiler our main() program will return an integer to the operating system; the return tells what integer value to return. This keyword could be void, indicating that the program returns nothing to the OS. #include <stdio.h>int main(){ printf("Hello World!\n"); return 0;} ECE Application Programming: Lecture 1
Final notes • Next time: • Data in C • Data types • Constants • Variables • Reminders: • Sign up for the course discussion group on Piazza! • Vote in the Doodle poll to schedule programming hours • Program 1 due Monday, 9/8 ECE Application Programming: Lecture 1