PIC 10a
Email: jjacobson@math.ucla.edu
Office hours: PIC lab, Tuesdays 3-4pm, Thursdays 2:30-3:30pm.
Midterm Review
Todd Wittman's
website has a bunch of old exams to review.
Example programs
I will be posting the examples from section on this website.
- Week #1:
simple.cpp,
if_example.cpp,
changecalc.cpp,
convert_coinage.cpp.
- Week #2:
continue1.cpp,
continue2.cpp,
find_letter_in_word.cpp,
find_string_in_line.cpp.
- Week #3:
formulas.cpp,
functions.cpp>,
palindrome.cpp>.
- Week #4:
animate.cpp,
multiple_returns.cpp,
- Week #5:
random.cpp,
vector1.cpp,
vector_strings.cpp,
remove.cpp,
cards.cpp,
- Week #6:
words.cpp
array_copy.cpp
pointers.cpp
pointers_arrays.cpp
classroom.cpp
classroom_nopointer.cpp
- Week #7:
grid.cpp
array2d.cpp
- Week #8:
Dictionary.h
CaseInsensitiveDictionary
spellcheck1.cpp
spellcheck2.cpp
animals.cpp
- Week #9:
recursion.cpp
Building graphics programs on a Mac
NOTE: If you already downloaded the Mac graphics files for HW3, you
should download them again for this assignment.
I've fixed some bugs and changed their names to be
more compatible with the Windows versions.
Instructions and relevant files are here.
Building C++ programs on a Mac
Here are some basic instructions on how to build and run C++ programs on a
Mac. If you run into problems, come by my office hours or send me an email.
The equivalent to Visual Studio on a Mac is called XCode. This is an
official Apple program which is distributed with all versions of Mac OS X.
If it's not already on your machine, you can install it from the DVD or CD
that came with your computer; it may be on a separate CD called "Developer
Tools". Alternately, you can download it from Apple's
website; they require you to register, but it's free.
Once you have it, open XCode, and do the following:
- From the "File" menu, select "New Project". Select "Command
Line Tool" and make it of type "C++" (it may be labelled "stdc++").
- Click "Choose...", give your project a name and save it somewhere.
- The project window will open, and you should see a list of files
including "main.cpp". Click it to get the file contents which you can write
your assignment in. If you see "main.c" instead: click it once, select
"Rename" from the Project menu, and rename it to "main.cpp".
- To run your assignment, choose "Build and run" from the "Build" menu (or
click the icon in the window, if there is one). Then choose "Console" from
the "Run" menu to see your program's output.