Central Connecticut State University Summer, 1st 5, 1998 CS 161 -- C Programming -- 1 Credit Section 50 MTWR 07:45-09:45 PM Room 208 Maria Sanford Hall May 26 to June 3, 1998 Instructor: Dr. Charles W. Neville Course Description: This is an accelerated course in C for students with a substantial programming background. Required Text: The C Programming Language, 2nd edition, by Brian Kernighan and Dennis Ritchie, Prentice Hall, 1989, Paper, ISBN 0-13-110362-8 The student will need at least three 3.5" HD floppy disks, and two or three folders with pockets in which to hand in lab assignments. Prerequisite: CS 152, CS II. You MUST be familiar with pointers, linked lists, and procedure calls including call by value and call by reference (non-VAR and VAR parameters). Course Objectives: Upon successful completion of this course, the student will: 1. Understand the basic structure of C programs. 2. Understand and use the basic C control structures, such as if ... else, switch, while, do, for, and break. 3. Understand and use the basic C data types. 4. Understand and write C functions. 5. Pass parameters to C functions, both by value and by reference. 6. Understand and use C arrays. 7. Understand and use C structures and unions. 8. Write significant application programs in C. Assignments and Exams: Reading and project assignments are listed below. Exam dates are denoted by **. Make-up exams are scheduled by appointment only. Project 1 is due Thursday, May 28. Project 2 is due on or before Monday, June 1. Project 3 is due on or before Wednesday, June 10 (one week after the course ends). Project 4 is due on or before Thursday, June 18. Mini-assignments should be done, but do not need to be handed in. Grading: Your final grade will be based on computer projects and in-class exams, and will be affected by classroom participation, conduct and attendance. The exams will include questions from the textbook and computer project assignments. The numerical grades for the exams will be averaged and then converted to a letter grade. Attendance: One unexcused absence is allowed, and any work missed must be made up. The student should notify the instructor concerning absences, or there will be a grade penalty. Student Conduct. It is expected that all students will conduct themselves in a respectful manner, and will assist in maintaining an atmosphere conducive to learning in the classroom. Honesty Policy. It is expected that all students will conduct themselves in an honorable and honest manner. It is alright to give and receive help on projects, but no student may claim another's work as his or her own, and no student may have another student's program in his or her possession. Students may use code from published sources, but if a student uses code from a source other than class or the text, the student should provide a reference in comments. Office Hours: Before and after class. Feel free to stay for help, and feel free to stay to chat. My office is in room 205 Maria Sanford Hall. In an emergency, email me at neville@ccsu.edu, (no comma at the end of the email address) or call me at 832-2719 (work). My Web page URL (Web address) is http://www.cs.ccsu.ctstateu.edu/~neville. (Again, no period at the end of the URL.) Day No. Reading and Project Assignments 1. 5/25 Chapter 1, A Tutorial Introduction Mini-assignment:Do Exercise 1-3, p. 13: Modify the temperature conversion program to print a header above the table. Mini-assignment: Do Exercise 1-7, p 13: Write a program to print the value of EOF Project 1: Do Exercise 1-14, p. 24: Write a program to print a histogram of the frequencies of different characters in its input. 2. Chapter 2, Types, Operators and Expressions Project 2: Do Exercise 2-1, p. 36: Write a program to determine the ranges of char, short, int, and long variables, both signed and unsigned by printing appropriate values from the standard headers and by direct computation. Chapter 3, Control Flow Mini-assignment: Do Exercise 3-4, p. 64: In a two's complement number representation, our version of itoa does not handle the largest negative number, that is the value of n equal to wordsize - 1 -(2 ). Explain why not. Modify it to print the value correctly, regardless of the machine on which it is run. 3. 5/27** Quiz 1 Chapter 4, Functions and Program Structure Mini-assignment: Do Exercise 4-4, p. 79: Add commands to print the top element of the stack without popping, to duplicate it, and to swap the top two elements. Add a command to clear the stack. 4. 6/1 Chapter 5, Pointers and Arrays Mini-assignment: Do Exercise 5-3, p. 107: Write a pointer version of the function strcat we showed in Chapter 2; strcat(s, t) copies the string t to the end of s. Project 3: This is Exercise 5-10, sort of. Write a program that adds up the values on its command line. So, for example, if the executable is named addup, addup 12 34 56 will print out 102, whereas addup -63 87 prints out 24. (Stolen from Bradley Kjell) 5. 6/2 Chapter 6, Structures Project 4: Do Exercise 6-3, p. 143: Write a cross-reference that prints a list of all words in a document, and, for each word, a list of the line numbers on which it occurs. Remove noise words like "the", "and", and so on. 6. 6/3** Final Exam