Two-dimensional arrays (matrices)
Arrays are perfect for representing a collection of values that can be thought of as a single dimension of
data. But for two-dimensional data, we cannot just create many different one-dimensional arrays. A
Random numbers are useful in many scientific applications. We often want to initialize parameters
for a formula with random numbers, or we want to generate some random data to test formulas.
Generating random numbers in C+ is rel
Midterm 3 Study Guide
The following problems will appear on the test:
Define abstraction. (1-2 sentences)
Why is abstraction good? (1-2 sentences)
Write a complete program that asks the user for a file name, opens that file and reads
"double" values from
Midterm 1 Study Guide
The first midterm is 48 minutes, in class, on paper. So it is a short test.
Make sure you know how to work out the following:
what variable "types" (d u l , i t b o , c a , s r n ) are appropriate for specific
obe n, ol hr tig
All of our programs so far have lived entirely inside the m i ( function. In other words, all the
code was in one big pile. Mathematics were mixed in with c u statements were mixed with file
operations. So far this has not been
It is extremely tedious to enter a lot of data by hand. It's far more common for programs to read data
from files, and write data to files, than ask the user to enter the data one value at a time.
Saving a list of doubles into a file, wit
Connect-four human-human game
Write a program that allows two humans to play Connect-four. The game is briefly described
Although I'm sure there are variants on this game, what's described here is how we will play it.
The game boa
Connect-four human-computer game
Write an "AI" computer player for the Connect-four game.
First, you'll need to copy the Connect-four code that I wrote. Do it like this (in Putty; don't forget
the final "dot"):
c /oe8ekohcnetfu/uc.oh .
Arrays are how we store many values of the same type in one variable. An array can be of any
size. If an array is of size n then the elements (values) of the array can be accessed with indices 0
through n 1 The memory "allocated" to an
Humans love lists, and the best list is the sorted list (sorted by name, sorted by date, sorted by net
worth, etc.). Rarely does our data come to use already sorted, so we'll need to sort it. Usually data
has a lot of fields (such as fi