CS151 is an introductory programming course. C++ will be the language we use to explorer fundamental programming concepts. If you are a computer science or Anderson School of Management student you should take CS152 which is taught in Java.



Phone No. 453-0688


Class hours: MTWR 11:00-12:15pm

Classroom: Dane Smith Hall 141

Office hours:  MTWR 12:30-1:30pm or by appointment.

Office location: Farris School of Engineering 301a



C++: How to Program, Fourth Edition
Deitel & Deitel

The textbook will serve as a general C++ reference for your assignments and as an alternate perspective on the material offered in lecture. Chapter numbers are given for each week in the schedule (below) but you will only be responsible for the topics covered in class and listed in the schedule. Some topics may be presented in class which are not covered in the book. These topics may still appear on exams and in homework assignments.


Online Resources

Course Web Page:
Course Mailing List:

Subscribe to the mailing list here:

Course related announcements will be made in class or via the course mailing list.

Discussion of class topics and sharing of ideas is encouraged. Posting of specific solutions (or parts of solutions) to homework assignments, projects, and exams is prohibited until three days after the assignment's due date (others may be turning assignments in up to 48 hours late).


Assignments will be made available on the course website. All projects and homework assignments will be due by 11:59:59pm on the date specified in the syllabus. These assignments are to be emailed to If your solution consists of multiple files send it as a tar or zip attachment. Make the assignment name the subject line of your email.


I will compile your programs with the GNU g++ compiler on the CIRT AIX computers when I grade them. You are welcome to use other compilers to test your programs at home but it is in your interest to make sure that your program works correctly after being compiled with g++.


Exams 30% (3 exams worth 10% each, including a final comprehensive exam)
Homework 30% + 5% (7 homework assignments worth 5% each)
Projects 40% (4 projects worth 10% each)
Total: 100% + 5% extra credit from homework

There will be three exams and four projects, together these will make up 70% of your grade. There will also be homework assignments designed to help you develop the skills you will need to do well in the projects and exams.

One of the homework assignments can be skipped or used for extra credit.

The exams will consist of comprehensive short answer and multiple choice problems.


Late Policy and Makeup Exams


Due Date: Assignment worth 100%.

24 hours late: Assignment worth 66% (D)

48 hours late: Assignment worth 33% (F)

More than 48 hours late: Assignment worth 0% (F)


Makeup exams will be held on the Friday following the original exam date at 11:00am. Eligibility to take the makeup exam will be decided on a case by case basis.

Academic Honesty


Freshman and sophomore level computer science classes are especially prone to cheating. Assignments are typically in electronic format and so easily copied. Students often believe that computer code is formal and therefore has a certain anonymity. Nothing could be further from the truth. To someone who has been reading C++ for a while the style and idiosyncrasies of each programmer is obvious. By the end of the semester I expect to be able to identify the author of every assignment by coding style alone. This makes catching cheaters easy.


UNM's policies on cheating may be found at The minimum penalty I will impose for cheating in this course is an F. The maximum penalty is dismissal from the University.


Cheating hurts the cheater and their fellow students. It hurts the cheater because they are not learning the material and will therefore do poorly on the exams and it hurts other students because it makes the assignments look artificially easy. By cheating to do well on an assignment that is too hard for you (and probably others) you ensure that the next assignment will be even more difficult.


Each semester of CS151 on average four or five cheaters are caught.


You may use the web and other resources (except other students) to help you write your programs. You may even include snippets of code in your projects and homework obtained on the internet. If you do so please mark that code clearly with the website address or a citation for the publication you used.


Letter grade translation:

100 <= A+ <= 105
93 <= A < 100
90 <= A- < 93
87 <= B+ < 90
83 <= B < 87
80 <= B- < 83
77 <= C+ < 80
73 <= C < 77
70 <= C- < 73
67 <= D+ < 70
63 <= D < 67
60 <= D- < 63
0 <= F < 60



Class hours: MTWR 11:00-12:15pm

Classroom: Dane Smith Hall 141
Office hours:  MTWR 12:30-1:30pm or by appointment.

Office location: Farris School of Engineering 301a

Week 1 - Read Chapter 1, Sections 1.1 - 1.4, 1.6 - 1.8, 1.11 - 1.15, 1.20 - 1.25


6/9                Course Information

                     What is programming? Algorithms

                     Anatomy of a Computer

                     Machine Language and Compilers

                     Brief History of Computer Languages


6/10               C++ Programming Cycle (Edit, Compile, Debug, Edit...)

                     Development Environments

                     Emacs Demonstration (HelloWorld)

                     Anatomy of a C++ program

                     LAB: Everyone compile HelloWorld


6/11             Variable Declaration

                    Assigning Values to a Variable

                    Primitive Arithmetic Operators

                    Primitive Logical Operators

                    Equality (==) and Assignment (=) confusion

                    Operator Precedence

                    Standard Input/Output


6/12              If control structure

                    If ... else ... control structure

                    Nested if and if ... else statements


Week 2 - Chapter 2


6/16             Lab: write a program that reads in two numbers and determines    

                   whether the the first number is the square root of the second.

                   Scope of Variables


                   While loops

                   do ... while loops                   

                   Homework 1 Due


6/17           For loops 

                  Nested iteration

                  Switch control structure

                  Break instruction

                  Continue instruction


6/18            Nesting control structures                 


6/19            Go over answers for Homework 1

                  Talk about Project 1

                  Homework 2 Due


Week 3 - Start Chapter 3


6/23          Go over answers for Homework 2


                 Calling Library Functions


                 Project 1 Due


6/24          Writing Functions

                 Function Definitions

                 Function Prototypes

                 Function Body


6/25          Function Signatures

                Overloading Functions

                Default Arguments

                Pass by reference


6/26          Go over Solution to Project 1

                Exam Review

                Homework 3 Due


Week 4 - Finish Chapter 3, Start Chapter 4


6/30          Exam 1


7/1            Go over exam

                Function Recursion


7/2            Function Recursion continued


7/3           Declaring 1D Arrays

                Using 1D Arrays

                Multidimensional Arrays

                Passing Arrays to Functions

                Homework 4 Due


Week 5 - Finish Chapter 4, Start Chapter 5


7/7            Searching and Sorting Arrays

                Linear Search and Binary Search

                Bubble Sort

                Project 2 Due


7/8           pointers

                pointer arithmetic

                pass by reference and arrays revisited


7/9           char* and char[] buffers

                string processing


7/10         Exam Review

                Homework 5 Due            

Week 6 - Chapter 5


7/14          Exam 2


7/15          Go over exam

                 Argv, argc
                 Function pointers


7/16          Skim Chapter 12 and Section 14.3

                 Input/Output Streams


7/17          File I/O

                 Homework 6 Due


Week 7 -  Chapter 6


7/21        The Heap and Stack

               New operator

               Dynamic Arrays

               Project 3 Due


7/22        Object Oriented Programming

               Classes (Inline)

               Public and Private Variables




7/23        Object Oriented Programming cont.


7/24        Object Oriented Programming Example

              Homework 7 Due


Week 8 - Chapter 6


7/28        Separation of Classes into Files  

              Makefiles and Linking programs


7/29        Makefiles and Linking, cont


7/30        Exam Review


7/31        Final Exam


8/2         Final Project Due