Introduction to Computer Science - C++

A C++ Tutorial

The Online C++ Textbook I am writing

  1. The Basics: What is an instruction?   What is a variable?
  2. User Interface: How can my program communicate with a person?
  3. If Else: How do I alternate what my program does?   Separating program flow.
  4. Loops: Repeating the same action more than once.
  5. Functions: What if I need to do the same actions but with different data? Or what if I want to do the same action in different parts of my program?
  6. Scope, functions and global variables, storage classes
  7. Arrays: Let's create a whole set of variables.
  8. Strings, Pointers and More Arrays.
  9. Const Pointers and Pointers to Constants.
  10. Introduction to Computing Algorithms: Search and Sort
  11. Recursion: Fancy stuff using methods - recursion
  12. Const with functions
  13. Using New in a function
  14. Mathematical Operations: Let's do some algebra in my program.
  15. Switch Case: More ways to alternate program flow .
  16. Templates.
  17. File Reading: How can I read input from a file on disk?
  18. File Writing: O.K., now how can I write to a file?
  19. Classes: Let me make my own class already!
  20. Enum enumerations
  21. Classes II: Now for some more details about classes.
  22. Virtual and Pure Virtual Classes
  23. Enum enumerations
  24. Quicksort
  25. Example of an expanding array using classes
  26. STL - vectors, list, iterators
  27. Exception Handling
  28. Operator Overloading
  29. Fifo implemented using an array of Nodes: fifoarray
  30. Tree built using Template
Some language specifications
Principles of Good Programming, Good Programming Practices, General Tips
An example of inheritance and virtual functions.

Syllabi for Computer Science Course

Homework assignments

Review Questions 2009

Semester I: A Review of what you should know for the Exam

Semester II: A Review of Terms


Course Description

Introduction to Computer Science - C++ is a first year computer science course designed to teach the basic concepts of computer science and Object Oriented Programming. A basic explanation of how a computer is built and runs is given. Details of the syntax of the C++ programming language including most keywords and operators are taught. Loops, array, and functions are covered in depth. String manipulation functions are explained and re-implemented. The course also covers the fundamentals of structured programming, functional programming, and object oriented programming design. Reading and writing to files is taught. Sorting algorithms and recursion are strongly emphasized. There is an extensive accompanying lab which includes many serious projects and utilizes all subjects covered with practical examples.

Course Outline

Week 1 Introduction to Computers and the Internet
Week 2 Introduction to C++ Applications
Week 3 Variables
Week 4 Input, output
Week 5 Control Structures in C++: if else, switch case
Week 6 Loops: while, do while and for
Week 7 Functions
Week 8 Scope, global variables
Week 9 Pointers
Week 10 Arrays
Week 11 Strings
Week 12 Advanced Functions: Recursion
Week 13 Advanced String manipulation
Week 14 Sorting Algorithms
Week 15 Object Oriented Programming

Textbook

Quotations about software writing

"Computers do what you tell them to do, not what you want them to do."
"I hear and I forget, I see and I remember, I do and I understand." - Chinese Proverb
"Seldom is your first idea a solution that works." -N.D.
"Seldom is the solution that works the best solution." -N.D.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan
"The compiler is your best teacher" -N.D.
"As long as you code doesn't compile, you can easilly fix it. Once it compiles, then the trouble starts" - N.D.
"Of course it works, Why should I compile it?" -J. Hoyland
"If it was hard to write, it should be hard to read." - anonymous sadist
"Always aim for the most readable code, not only for the next fortunate soul who claps eyes with your code, but also for yourself. Have you ever looked at code and wondered, 'Who in their right mind wrote this stuff?!' only to find it was you? I know I have." - Trey Nash (from Accelerated C#)
There are 10 kinds of people: Those who understand binary math and those that don't.

Useful (and interesting?) Links

Why programming concepts is better to learn than cookbook style programming:

"Ex-Professors Urge Return to Basics in Computer Science" Two former computer-science professors from New York University say education in their field is failing to teach basic skills. In an essay from The Journal of Defense Software Engineering, Robert B.K. Dewar and Edmond Schonberg, who are now in private industry, point to shrinking math requirements and "cookbook" approaches to programming that lead to a future of insufficiently trained professionals. In particular, they mention the introduction of Java as students' first programming language: "What we observed at New York University is that the Java programming courses did not prepare our students for the first course in systems, much less for more advanced ones," they write. The Java courses, they explain, teach the use of libraries and frameworks instead of important underlying processes. They call for computer-science programs to teach a broader range of languages, giving students a better understanding of the programming process. --Hurley Goodall (January 2008)

© Nachum Danzig