General Reference

While information on this page may be useful, it is not required reading, unlike the other pages on the site!

See the C Libraries (and a local copy), ASCII table, and precedence in C.

See the CS 141 C++ pages on Recursion and Linked Lists.

Want even more C++ beyond CS 141? See this handout that has C++ content beyond what is appropriate for CS 141.

For archived reference material (whose links mostly do work!) see the WayBackMachine version of Reed's website.

How to Remember More

We remember:

10% of what we read (e.g. our text book)

20% of what we hear (eyes closed, listening in class)

30% of what we see (overhead or chalkboard)

50% of what we see and hear (lecture w/board

70% of what we discuss with others (class discussion, lab groups)

80% of what we experience personally (programming assignments)

90% of what we teach to someone else (lab groups)

-William Glasser

How much do you want to remember?

What's the Point of CS Anyway?

Computer are increasingly being used to do things people used to do, freeing up people for other tasks. (e.g. measuring, counting, translating, communicating, conveying.) Consider the following example (taken from Harvard's course cs50.) How can we efficiently count students in the room?

      • Simple way: Have one person stand in front of the lecture hall and point to each student once,saying “1, 2, 3, …” until each student has been counted.

      • This will take as many steps as there are students, say, 64

      • We can do better by counting in twos in just 32 steps. But even if we count by threes or fours,the number of steps will always be proportional to the number of students

      • Can we employ an algorithm that increases in speed as we increase the number of students?

We can count the number of students in the room by having each individual do the following:

1. Stand up

2. Assign yourself the number 1

3. Find someone that is standing up.

4. Add your number to that person’s number. The total is your new number.

5. One of you sit down.

6. If you are still standing, go back to step 3.

7. Algorithm finishes when there is one person standing. Her number is the number of students in the class.

Employing this algorithm, we might find that there are about 64 students in the room. How efficient is this?

      1. If there were 2 people, it would take one iteration of the above algorithm to count

      2. If there were 4 people, it would take two iterations

      3. Similarly, for n people, it would take log2n iterations

      4. For 64 people, it should take 6 iterations. Another way to think about it is that each “round” cuts the number of students still standing in half. So if there are about 64 students, it will require 6 rounds because we can halve 64 six times.

      5. If we graph this, we see that it takes a relatively long time for small numbers of students, but as the number of students grows, the algorithm seems to speed up

      6. For 4 billion students, it would take just 32 iterations!

Graphing this looks like the image shown below:

UNIX Commands

    • See Kevin Heard (Berkeley) nicely explained UNIX tutorial

    • Consider learning the vi, pico, Nedit or XEmacs editors. Also check out the ddd debugger.

Integrated Development Environment (IDE)

While different students will use different machines (PC/Mac/Linux) and different IDEs, in order to get credit your program must run in the environment used for grading, indicated by the instructor. Be sure to leave time to test your program in the environment used for grading, since there are differences between assumptions made and automatically included libraries between different IDEs. Recommended IDEs are listed first.

Everyone (Windows / Mac / Linux)

    • JetBrains' CLion IDE offers the CLion development environment free to all students. See https://www.jetbrains.com/student/. CLion includes a nice debugger. There are two major parts to the installation:

      1. After creating a JetBrains Academic account, download and install the product you want (CLion in this case). After installation when you first run it you'll be prompted to enter your JetBrains account information, which will allow you to use it free for a year, at which point you can renew it and keep using it as an academic user.

      2. Download and install a compiler to use with CLion, MinGW in this case. See this YouTube installation video, and in particular pay attention at 2:43 to the details on how you must also install the compiler.

    • VS Code is a popular cross-platform editor, though the configuration can be a bit finicky. It is easier to get it to work on Windows than on a Mac.

PC Users

    • DevC++ is an easy to use Windows IDE. The debugger is sometimes a bit flaky, so towards the end of the semester you will want to transition to a more robust program. To enable C++11 in DevC++ (if not already enabled) go to menu option Tools / Compiler Options / Programs and update the fields next to gcc and g++ to also have: -std=c++11 For example: gcc.exe -std=c++11

    • Microsoft's Visual Studio Community is a free download and gives you a very robust IDE. You can alternatively download the full version of Visual Studio from the UIC Web Store. The full version of Visual Studio gives you more options than you need for this course, which can be confusing. See Prof. Hummel's tutorial on getting started with the full version of Visual Studio. Following are some older tutorials:

        1. See this tutorial, and also Bob Hahurst's guide to getting started with Visual Studio.

        2. When creating a project be sure to uncheck the box that says "include precompiled headers," otherwise you will end up needing a Microsoft-specific line at the top of your code (#include "stdafx.h") which will cause an error when being graded elsewhere. Visual Studio (in C) wants you to use the Microsoft "scanf_s" instead of standard "scanf". To disable this, put this at the beginning of your program:

          • Newer Versions: #pragma warning(disable:4996)

          • Older Versions: #define _CRT_SECURE_NO_WARNINGS

          • Or from the Project menu select: "project_name" Properties -> C/C++ -> SDL checks -> No (/sdl-)

Mac Users

Programming in the Cloud

  • VS Code is a wildly popular cross-platform editor and (I'm told) allows collaboration

  • repl.it

  • codepad.org. For instance see this example. Note that you can't read from files or handle user input.

  • ideone.com, which does allow for user input, though it is awkward. It allows 1,000 free submissions/month.

  • Google Collab allows you to create and run code in the cloud as a Jupyter Notebook, such as this example.

For online collaboration tools, to find the latest I suggest doing a google search using: online programming collaboration tools free

Debugging

As your programs become more complex, using a debugger is essential to quickly finding bugs in code. See the following guides [Thanks to Abhinav Kumar]:

Free Books

If you are just starting out with C++, see Mark Mahony's Animated Introduction to Programming in C++

For UIC students the library has free access to the online Safari CS books which includes Java and C++ programming books. I suggest:

Programming in C, Third Edition, by Stephen Kochan

C++ How to Program, 6th Edition, by Deitels

Also see UIC's online Lynda video training modules, with many C++ offerings.

If you don't have access to the online UIC library, consider Programming in C++ by Eric Roberts (2012 edition). Also see the stackoverflow.com list of freely available programming books. (Thanks to George Lamperis) I suggest:

C: The C Book, by Banahan et. al.

C++: Thinking in C++, by Bruce Eckel

Java: Thinking in Java, by Bruce Eckel;

How to Think Like a Computer Scientist, by Allen B. Downey

Learning C++ after Java:

If covering this material after Java, See the MS Word document highlighting the difference between Java and C, and also this brief "Hello World" example for I/O in both C and C++ (and a syntax-highlighted pdf version).

See also a crash course in C++ for Java Programmers. (resource accompanying Horstmann's book "Big Java"

Online Courses and Tutorials

Courses

  • Coursera CS101 by Nick Parlante (Standford). Introduction to Computers for those who start with zero knowledge. Some programming in the browser using Javascript.

  • Udacity CS101 by Dave Evans (Virginia Tech). Select the "Start Free Courseware" button. Learn Python to build your own web crawler.

  • edX CS50X by David Malan (Harvard). Programming in C, PHP and Javascript. See also Malan's Extension School Intensive Introduction to Computer Science

  • edX 6.00.1x by John Guttag (MIT). Python Programming

See also the OpenCourseWare extensive list of online CS courses.

Tutorials

CodeAcademy.com (as of Oct 2012 has Ruby, Python, Javascript, Web development)

CodingBat.com (as of Oct 2012 has Java and Python, by Nick Parlante at Stanford)


Pretty Printer

If your IDE does not have an option to automatically format your C code, then you can use this tool online

To get syntax highlighting with line numbers that you can use copy/paste into Word, copy/past your code into planetb.ca/syntax-highlight-word and from there copy/paste it into Word or OneNote.

To get syntax highlighting with line numbers and generate HTML try hilite.me

Testing

Knowledge in software testing is one of the skills many employers ask for from graduating students. What does this mean in practical terms? Explore this on the testing page, learning about equivalency and boundary tests, with a hands-on exercise to test your skills.

Other