Date  Class Materials  HW assignment 
05/23  Final Exam CP 320 10 am  11:50am The exam is closed book and closed notes. You can use three cheat sheets, letter size, both sides. No smart phones, no personal laptops. You are allowed to use the Visual Studio C++ compliter installed on machines in class only for Part III, but you are not allowed to use search engines, nor any other programs. You can view your grades in this Google spreadsheet. The Final Grade will be composed of: homeworks average (20%) quizzes average (20%) Midterm exam score (30%) Final exam score (30%) 

Extra credit assignment  some solutions: Part 2 suggested solution: TwoIntoOnesuggestedSolution.cpp Part 3 suggested answers: CSI32ExtraCreditAssignmentPart3answers.pdf 

05/16  Preparing for the final exam We will try to cover all the slides: CSI32PreparingToFinalExam.pdf We didn't finish going over it This is the work we did in class: program 3 (for Chapter 3 slide), program 8 (for Chapter 8 slide), complex.h Visit Midterm and Final Exams page to get more information about the final exam and study guide. 

05/11  Chapter 21: Algorithms and Maps, Sections 21.5  21.9 Lecture slides Programs: mapsExamples.cpp, article.txt; setExample.cpp Suggested solution to inclass work (ages): ages.cpp 
Homework assignment that won't be graded, but you must work on it: Chapter 21: 1) Looks through Sections 21.1  21.9 (it includes information from this and previous class) 2) Look through the lecture slides and all the examples thoroughly practice: Chapter 21: work on the inclass work 
05/09  Chapter 20: Continers and Iterators + find(), find_if and function objects with lambda expressions from Sections 21.1  21.4 Lecture slides Programs: functions.cpp, records.cpp Afterclass notes: 1) We stopped at slide 44, to work on two items from functions.cpp file (at the end of the file)  we did only one item Work on the second item and I will be posting the soltuion shortly. Here is a solution (all the changes to the function.cpp are commented): InClassWork.cpp 2) Go through the rest of the slides, see file records.cpp that contains all the code from that part. Run it, play with it. 
Homework assignment that won't be graded, but you must work on it: Chapter 20: 1) Read Sections 20.1 and 20.10 2) Look through the lecture slides and all the examples thoroughly 3) Read thr afterclass notes and do the work that is asked for in the notes 4) Look at the posted programs, make sure you understand everything that is done there 5) Review the code of Less_than function object, then constuct Greater_than function object and test it on vector of integers, looking for value greater than 5, and on the list of strings, looking for a word greater than 'hi' 6) more practice will be posted shortly for practice: Chapter 20: 1) Drill (all items) 2) Review: 110, 1215, 19, 2223 For selfdevelopment (not for grade, no questions will be based on this material): Read Sections 20.5  20.9 
05/04  Recursion with C++ Lecture slides Programs: FibFunctions.cpp, palindromes.cpp Suggested solution to inclass work (recursive factorial function, etc.): factorial.cpp 
for practice: 1) CSI32Lecture21suggestedPratice.pdf 2) virtualFunctionsInClssWork.pdf 3) CSI32Lecture22suggestedPratice.pdf x 
05/02  Classes: inheritance, polymorphism, hierarchies, etc. based on chapter 14, section 14.3 in particular Lecture slides Programs: someClasses.h and inheritanceExamples; point.h, Shape.h, quadrilateral.h, trapezoid.h For inclass work: virtualFunctions.h Quiz 8 based on Chapter 18 material will be at the end of the class. This will be our last quiz. Afterclass notes: We didn't have time to go over the inclass work: virtualFunctions.h Pease walk through these guided instructions: virtualFunctionsInClssWork.pdf 

04/27  Chapter 19: Vector, Templates and Exceptions, Sections 19.4  19.5 Lecture slides Inclass work: use the handout I distibuted in class. We are working on a Tracer class where its constructor and destructor print messages. Tracer is used to see where RAII management objects will do their work (i.e. experiment with global objects, local objects, ...) This is what we got: tracer.h, reporterMoreWork.cpp (please take a look at the make_unique use  I found a correct way of using it!) 
HW 9 (due Thursday, May 11th)  last HW assignment Chapter 19: 1) Read about optimized assignment on page 676 (from Section 19.2.5) 2) Read sections 19.3.2, 19.3.3, 19.4.1, 3) Review lecture slides and the code we have 4) work on our inclass practice and see the proposed solutions 5) Do the Chapter 19 Drill, 6) Do the Chapter 19 Review 7) Exercises to submit (for grade): (1) Grab the file arraysWork.cpp. It will not compile as it has some errors in it. Feel free to remove them when you are working on the code. Your goal is to comment every single line in the function main (except for the return statement) with what is being done in this line; for print statements place what values did you see and what do these values represent. Those lines that have errors also must be commented on (so don't forget to return them back): what is attempted to be done and why it is an error. (2) Recall the struct Link from the last inclass practice in Lecture 16 (we worked on it in the next class). I defined a class ListNode very similar to it, with few extra defintions added: ListNode_str.h. Rewrite it as a template class, and rename the file to ListNode.h 8) Exercises to get more practice: 1, 2, 10, 12 
04/25  Chapter 19: Vector, Templates and Exceptions, Sections 19.1  19.3 Lecture slides Vector class: vector.h, vectorTesting.cpp Template vector class: vectorT.h, testvectorT.cpp Meeting recordings: part 1, part 2 Afterclass meeting notes: 1) on slide 34 I proposed to convert/rewrite the given funciton to a template function and showed you how I would do it. Restore what I did, and then test your function using this test code: cout << add cout << add(std::string("I'm just fine! "), std::string("thank you!")) << endl; cout << "5+6=" << add(5, 6) << endl; cout << "5.4 + 7.8 = " << add(5.4, 7.8) << endl; 2) grab the file vector.h, there is a commented out definition of the funciton fill(). Uncomment it and move it out of the definition of the class vector (it is a standalone method) and use it (now it should be working). You can use this test code: cout << "input values for v3, separated by white space, then press CTRLZ and hit Enter:"; vector v3 = fill(std::cin); cout << "* vector v3 has size of " << v3.size() << " :\n" << v3 << "\n"; cout << "* vector v3 has space of " << v3.capacity() << "\n"; This function is of special interest to us, since the move constructor will be implicitly used to implement the return, because compiler knows that res is about to go out of scope. Quiz 8 based on Chapter 18 material will be on Tuesday, May 2nd, at the end of the class. This will be our last quiz. 

04/20  Chapter 18: Vector and Arrays, Sections 18.4  18.7 Lecture slides We will used a cleanedup and reorganized code for our vector class: vector.h, vectorTesting.cpp * What was done * : 1) only function's headers (prototypes) are left in the definition of the class vector; their definitions are moved down, with scope resolution vector:: 2) copy was made a private member function (a helper method used by copy constructor and assignment operator), since it will only be used by member functions 3) member function display is removed since we have overloaded output operator 4) resize was also made private as it will be used only by the member function(s) Other programs: arraysWork.cpp, palindromes.cpp Afterclass notes: 1) look at the slide 24 titled a "Why bother with arrays?" 2) I didn't cover the palindromes. I will use it later on, when we will talk about recursion. Code we produced in class: arraysWork.cpp, testingVector.cpp Updated vector class header file: vector.h Quiz 7 based on Chapter 17 at the end of class 
HW 8 (due Thursday, May 4th): Chapter 18: 1) Look throught the sections 18.1  18.7, 2) Read sections 18.4.2, 18.6.4, 3) Review lecture slides and the code we have 4) work on our inclass practice and see the proposed solutions 5) Do the Chapter 18 Drill, 6) Do the Chapter 18 Review 7) Exercises to submit (for grade): CSI32HW8assignment.pdf, polynomial.h, testPolynomial.cpp 8) Exercises to get more practice: to be posted 
04/18  Plan for the meeting: 1) Our Final exam is scheduled for Tuesday, May 23rd 2) extracredit assignment 3) last inclass practice exercise from the lecture before the spring break 4) Chapter 18: Vector and Arrays, Sections 18.1  18.3 Lecture slides Code we did in class: vector.h, testing.cpp Quiz 7 based on Chapter 17 material will be on Thursday, at the end of the class 

04/05  04/13  Spring Break Extra Credit Assignment: The following is a not mandatory assignment. It is an opportunity to earn extra points towards your final grade. Overall, you can earn up to 16 points towards your final grade. You can pick any or all parts. The due date is Tuesday, April 18th. There will be no resubmissions given. Part 1 (5 points): SplitIntoFunctions.cpp, data file I used for it: inputData.txt Part 2 (4 points): TwoIntoOne.cpp, Part 3 (7 points): CSI32ExtraCreditAssignmentPart3.pdf By submittting your work to me you certify that it was solely your work. Note that group work is not allowed. Our Final Exam is scheduled for Tuesday, May 23rd, same time and same place. 

04/04  Chapter 17: Vector and Free Store (the rest of sections) Lecture slides We added operator= overloading to our class vector code: simpleVectormoreWorkDone.cpp Afterclass notes: We didn't have a chance to look at the linked nodes (slides 19 and 20)  please review them on your own. 
extra credit assignment will be discussed 
Answers and solutions to inclass work: 03/28: problem 1: lecture14InclassWorkproblem1.cpp problem 2: Lecture14InClassWorkproblem2.cpp problem 3: picture (jpeg), 03/30: simpleVectorinClassWorkCompleted.cpp 

03/30  Chapter 17: Vector and Free Store, Sections 17.3 (sizeof), 17.4 (the rest), 17.5, 17.6 Lecture slides Programs for class meeting: sizeOfoperatorUse.cpp, simpleVector.cpp What we did so far: simpleVectorinClassWork.cpp Quiz 6 based on Chapter 10 at the end of class 
HW 7 (due Tuesday, April 11th): Chapter 17: 1) Look throught the sections 17.1  17.10, 2) type in all the code we have in lecture slides, print/display as much information as possible 3) work on our inclass practice and see the proposed solutions 4) Do the Chapter 17 Drill, 5) Do the Chapter 17 Review 6) Exercises to submit (for grade): CSI32Lectures1415HWAsignment.pdf, use the test code 7) Exercises to get more practice: 6, 7, 8 
03/28  Chapter 17: Vector and Free Store, Sections 17.1, 17.2, 17.3 (no sizeof yet), 17.4.1, 17.4.2 Lecture slides Quiz 6 based on Chapter 10 material will be on Thursday, at the end of the class 

03/23  Chapter 10: Input and Output Streams, Sections 10.7  10.11 This will be online meeting, via Zoom. The Zoom link is posted on the Blackboard and was suppleied in the Blackboard announcement. Plan for today: 1) We will look at the temperatures example and modify our code to employ the I/O error handling. Consider this temperature readings file: temps2.txt 2) We will talk about the inclass practice 3) We will continue covering Chapter 10. Lecture slides Quiz 5 based on Chapter 9 will be at the end of class, on Blackboard. The quiz will be timed at 20 minutes and you will have an opportunity to take it only once. Don't forget that Blackboard tends to log users off after few minutes of idle. After class meeting notes: 1) Here you can find the video recording of I/O error handling in "temperature reading" program Here is what we did in class (not finished): temperatureReadingsModded.cpp Here is a suggested code with output file and the endcases solved (finished): temperatureReadingsModified.cpp Note: the program didn't handle the case fgh(for hour) 76.56(for temperature) correctly! The code needs further improvements. Here is the temperature recordings file on which the code crashes: temps3.txt 2) Here you can find the video recording of inclass practice from March 21st meeting  we continue to work on it This is what we have so far: InClassPractice.cpp I suggested that you continue to work on it, and then on Friday I will post a suggested solution. Here is a suggested solution: inClassWorkFinal.cpp 3) Here you can find the recording of the rest of the lecture. 4) I promissed to update Google sheets by today, 5pm. 
HW 6 (due Thursday, March 30th): Chapter 10: 1) Look throught the sections 10.1  10.6, read Section 10.7 Reading a single value, 2) Do the Chapter 10 Drill, 3) Do the Chapter 10 Review 4) Exercises to submit (for grade): 11 5) Exercises to get more practice: 1, 2, 3, 4 
03/21  Chapter 10: Input and Output Streams, Sections 10.1  10.6 Lecture slides Programs for class meeting: temps.txt, temperatureReadings.cpp Useful links: 1) std::except 2) open mode for file streams Quiz 5 based on Chapter 9 material will be on Thursday, at the end of the class After class notes: 1) We modified the code a bit, and "messed up" with the input text file to see what will happen 2) We started working on the inclass practice. Here is what we did in class: f1.txt, f2.txt, inClassWork.cpp more work is needed to complete the code. I mentioned in class that I need to understand how to follow the strategy I gave for merging the files  it looks like I need to know how to "step back" in a file. Try to continue working on it  see what you are getting. I will either finish it in the next class or post a solution 3) Look through the rest of the lecture slides (from slide 17), namely I/O error handling. I will incorporate something from this Section in the program that we worked on today 4) Important: We might have an online meeting via Zoom on Thursday. The Zoom link is posted at the Blackboard. By Wednesday, 5pm I will send a message via Blackboard announcement with the final say: online or inperson. 

03/13  03/17  Midterm Exams week We will have a review on Tuesday, March 14th: I will bring some sample questions and will tell you the structure of the midterm exam. Sample Midterm Exam questions, answers, program (Part III) The Midterm Exam will be on Thursday, March 16th. See the details on the Midterm and Final Exams page You can view your grades in this Google spreadsheet. The Midterm Grade will be composed of: homeworks average (30%) quizzes average (30%) Midterm exam score (40%) 

03/09  Chapter 9: Technicalities: Classes, etc., Sections 9.5  9.8 We will continure working on the Date class. Here s what we need to do: 1) Find out what generates the runtime error and fix it 2) test the ternary operator 3) add the copy constructor 4) overload the operator==, operator!=, operator= 5) add default date 6) anythning else that comes to mind! Quiz 4 based on Chapter 8 will be at the end of class The finished code of the Date class: Date.h, Date.cpp, testing.cpp 
HW 5 (due Thursday, March 23rd): Chapter 9: 1) Look throught the sections 9.5  9.8, specifically look through subsection 9.5.1 (we didn't use "plain enumeration in our code; in this section the author discussed why shouldn't it be used in some circumstances), 2) Finish the Chapter 9 Drill, 3) Finish the Chapter 9 Review 4) Exercises to submit (for grade): 6, 7 5) exercises to get more practice: 13 
03/07  Chapter 9: Technicalities: Classes, etc., Sections 9.5  9.8 Lecture slides Code we have so far: Date.h, Date.cpp, testing.cpp, Our tentative Midterm Exam date is Thurday, March 16^{th} and review date is Tuesday, March 14th. You can find midterm preparation guidelines here (and more information on the Midterm and Final Exams page). 

02/28  03/02 inclass work  (1) Here is the finished work on NameAge pairs class:
NameAgecompleted.cpp 

03/02  Chapter 9: Technicalities: Classes, etc., Sections 9.1  9.4 Lecture slides program: Date.h Quiz 4 based on Chapter 8 will be on Thursday, March 9th, at the end of class After class notes: 1) this is what we did so far with the Date class: Date.h and Date.cpp 2) Here is the unfinished inclass work: NameAge.cpp. Finish it for practice. 
HW 4 (due Thursday, March 9th): Chapter 8: 1) Read sections 8.2.3, 8.4 (starting with the sentence "Note that most C++ constructs that define scopes nest:..."), 8.5.7, 8.6, and 8.6.1. Chapter 9: 1) Look throught the sections 9.1  9.4, 2) Do the Chapter 9 Drill, 3) do the Chapter 9 Review 4) Exercises to submit (for grade): 5 5) exercises to get more practice: 9, 10 
02/28  Chapter 8: Technicalities: Functions, etc.,
Sections 8.5  8.7 (finishing up) Lecture slides program from lecture slides: CompileTimeExamples.cpp for inclass work: statsProgram.cpp what we did so far in class (a full solution will be posted on Friday): statsProgramInClassWork.cpp Quiz 3 based on Chapter 5 will be at the end of class You can view your grades in this Google spreadsheet. 

02/20  02/24  Monday, February 20th  BCC is closed. President's Day Tuesday, February 21st  runs on Monday schedule Thursday, February 23rd  no meeting for our class only, please read Chapter 6 

02/16  Chapter 8: Technicalities: Functions, etc., Sections 8.2, 8.4  8.5 (to be continued) Lecture slides inclass programs: Example.cpp, statsProgram.cpp A modification of the program from Example.cpp: ExamplemodifiedInClass.cpp Quiz 3 based on Chapter 5 will be on Tuesday, February 28th, at the end of class 
HW 3 (due Thursday, February 23rd): Chapter 5: 1) Read section 5.8, 2) Do the Chapter 5 Drill / the rest, 3) do the Chapter 5 Review / the rest Chapter 8: 4) Read Section 8.1 5) Do the Chapter 8 Drill, 6) do the Chapter 8 Review , 7) Exercises to submit (for grade): 5, 13 8) exercises to get more practice: 2, 3, 4, 9 
02/14  Chapter 5: Errors, Sections 5.7  5.11 Lecture slides Inclass work: grab this code and debug it! After you debugged it, and it works correctly, add exceptions (when user enters something wrong) This is what you can check the correctness of the program on: equation x^24x + 4 = 0 has one solution, it is 2 equation x^23x + 4 = 0 has no real number solutions equation 2x^2+7x15 = 0 has two solutions, 5 and 3/2 Quiz 2 based on Chapter 4 will be at the end of class 

some comments and solutions from week of Feb. 7th  9th  At the meeting on February 7th, we have an inclass practice that we were not able to complete: Write a program that reads in a sequence of decimal values from keyboard (from the user), and then displays: – the mean (same as average), – the median value, and – the largest and the smallest values in the sequence. Here is how we find the median: 1) order the data values from smallest to largest 2) for odd number of data values, the median is the middle value 3) for even number of data values, the median is the avverge of the two middle values. Examples: for values 4, 7, 18, 19, 23, the median is 18 for values 4, 7, 18, 19, 23, 30, the median is (18+19)/2 = 18.5 Use vector for storing data values; You can start by writing the code as one function, test it and correct all mistakes. Then split the code into functions, for example, have a function that will calculate the mean, have a function that will calculate the median. Here is one function code: statsProgram.cpp 

02/09  Chapter 5: Errors, Sections 5.1  5.6 Lecture slides programs: ThrowingAndCatchingExample.cpp Quiz 2 based on Chapters 4 will be on Tuesday, February 14th, at the end of class Useful links: 1) just some general info about exceptions in C++ 2) exception class 
HW 2 (due Thursday, February 16th): Chapter 4: 1) Read sections 4.3.2, 4.3.3, 4.4.1.3, 2) Do the Chapter 4 Drill on page 126 / the rest, 3) do the Chapter 4 Review on page 127 / the rest, 4) Exercises to submit (for grade): Chapter 4, pages 128131 / 1921, additional comments: do each of the exercises is a separate function, i.e. #19: define a function getData(vector < string >& names, vector < int >& scores) Here is some test code you can use: HWtestingCode.cpp #20: define a function getScore(vector < string > names, vector < int > scores, string name) Here is some test code you can use: HWtestingCode.cpp #21: define a function getNames(vector < string > names, vector < int > scores, int score) Do not forget to declare vectors before function getData! 5) exercises to get more practice: Chapter 4, pages 128131 /#9, 10 Chapter 5: 6) Read sections 5.1, 5.3  5.5 7) Do the Chapter 5 Drill, 8) do the Chapter 5 Review / 14, 610, 1213, 1516, 9) Look over the Chapter 5 Terms/ see which terms you already know, and which not, 10) Exercises to submit (for grade): Chapter 5 Exerises / 8 (do not answer the questions), 11) exercises to get more practice: Chapter 5 Exercises / 2, 3, 4, 5 12) (selfdevelopment): Look at the Appendix B, Section B.2 Error Handling Attention: Send your homeworks as attachments to natna20@gmail.com, and don't forget to put homework number in the subject field (like HW 1) 
02/07  Chapter 4: Computation, Sections 4.5  4.7, Chapter 8: Technicalities: Functions, etc., Sections 8.1, 8.3 and part of 8.4 Lecture slides programs: VectorWork.cpp Quiz 1 based on Chapters 2 and 3, at the end of class Useful links: 1) Vector class description and operations 

HW 1 (due Thursday, February 9th): Chapter 3: 1) Read sections 3.4, 3.7, 3.8 and 3.9, 2) Do the Chapter 3 Drill on pages 8384, 3) do the Chapter 3 Review on pages 8485, 4) Look over the Chapter 3 Terms on page 85, 5) Exercises to submit (for grade): Chapter 3, page 86/ #4, 6, and 10, 6) exercises to get more practice: Chapter 3, pages 8667 / #7, 8, 9, 11, Chapter 4: 7) Read sections 4.3.2, 4.3.3, 4.4.1.3, 8) Do the Chapter 4 Drill on page 126 / items 19 only, 9) do the Chapter 4 Review on page 127 / items 122 only, 10) Look over the Chapter 4 Terms on page 128, 11) Exercises to submit (for grade): Chapter 4, pages 128131/ #5, 12) exercises to get more practice: Chapter 4, pages 128131 / #4, #8 Remember: submit your homework via email to natna20@gmail.com, and


some solutions  suggested solutions: 1) InclassWork2Answer.cpp, 2) exampleAnswer.cpp (you were asked to come up with a couple of inequalities that either mathematically correct, but C++ will state that they are false, or mathematically false, but C++ will state theat it is true) 

02/02  Chapter 4: Computation, Sections 4.1  4.4 Lecture slides programs: incrementExamples.cpp, example.cpp, switchExample1.cpp, switchExample2.cpp Announcement: Quiz 1 will be based on Chapters 2 and 3. 

01/31  Chapter 3: Objects, Types , and Values Lecture slides programs: InputOutputWithStrings.cpp, InclassWork1.cpp, InclassWork2.cpp, typeSafetyExamples.cpp Announcement: Quiz 1 will be on Tuesday, February 7th, at the end of the class. It will be timed at 15 minutes. All quizzes are closed book, closed notes and no use of computer/laptop/etc. Aftermeeting notes: We completed slides 113 (finished working on InclassWork1.cpp). Here is what we did in file InclassWork1.cpp You are to work on InclassWork2.cpp (at least try), however I will talk about it briefly at our meeting on Thursday. Solution will be posted by Friday. You should also look through slides 1518 and read the corresponding sections (as given in the HW assignment). I will also talk about it at our Thursday meeting. I will go over slides 1920 at our Thursday class meeting. 

01/26  Welcome to CSI 32! Plan of the meeting: 1) Introductions and course structure 2) Chapter 2: Hello, World! Lecture slides Texbook support: https://www.stroustrup.com/programming_support.html Chapters 24 are available at ereserves: http://bcccuny.libguides.com/er.php?b=c Choose CSI32 from the list Header file that is used throughout the textbook: std_lib_facilities.h 
HW 0 (due Tuesday, January 31st): Reading assignment: 1) read Preface 2) Read Chapter 0: Notes to the Reader 3) Read Chapter 2 (if you don't have the textbook yet, it is available at library ereserves) Practice assignment (not for submission, not for grade): in Chapter 2:  do the drill,  look over review and terms,  work on all the exercises. For selfdevelopment: See a short article Key Differences Between C++ and Python Please remember:
