One peculiarity with Borland C++ 5.0 is that a program's output can disappear before the user has had a chance to read it. For a way of getting around this problem see framework.cpp.
Old Exercises (a good source of practice material)
Fall 2001 Exercise Page
Winter 2002 Exercise Page
P.S. Disregard the marking scheme remarks - these apply only to the terms in question.
Exercise #1 (OC Transpo)
Question (PowerPoint slides)
Executable (run this to see how your program
should work)
Solution
Exercise #2 (Resistors in Parallel)
Question (PowerPoint slide)
Executable
Solution
Exercise #3 (Car Payments)
** Both of these files were updated October 3rd at 10:00.
** I had a typo (.05 for 0.5) in both the question my program.
Question (PowerPoint slides)
Executable
Solution
Exercise #4 (Bus Times)
** Oops! I originally posted an early version of my executable
- one that didn't check for invalid times.
** The executable was replaced with one which works properly
at 8:15 on October 10th.
** To the students who pointed out this problem - thank you.
Question (PowerPoint slides)
Executable
Solution
Exercise #5 (Kingdom of Ecorania - Tax Calculations)
** A typo in the question (one of the two other functions is to calculate
the taxable income
** and not the earned income) was fized at 11:45 on Thursday, October
17th.
Question (PowerPoint slide)
Skeleton Program (your starting point)
Executable
Solution
Exercise #6 (Day Numbers)
** I'm having a very bad run here! Two typos in the question
and a bug in the executable
** were fixed at 8:45 on Wednesday, October 23rd.
** Some more minor problems were fixed on October 28th.
Question (PowerPoint slide)
Skeleton Program (some handy functions)
Executable
Solution
Exercise #7 (Craps Probabilities)
Question (PowerPoint slides)
Executable
Solution
Exercise #8 (Railway Bridge Safety)
Question (PowerPoint slide)
Executable
Sample Data File (try processing this assuming
a four car long bridge that can support 1200 tons)
Solution
Exercise #9 (Beam Deflections)
*** A mistake in the question (equation 1 was incorrect) was fixed at 8:00, Wednesday, November 13th ****
Question (PowerPoint slides)
Executable
Basic Solution
Solution with Extras
Exercise #10 (Hangman)
Question (PowerPoint slide)
Executable
Sample Targets File
Skeletal Program
Solution
Exercise #11 (Beam Moments)
*** A second mistake in the question was fixed at 8:00, November 27th. Thanks to Matthew Walsh for finding.the problems.
Question (PowerPoint slides)
Executable
Skeletal Program
Solution
--------------------------------------------------------------------------------------------------------
Note to students using Microsoft Visual C++:
You can get around the fact the "clrscr" is not available in this environment
by writing it yourself.
Mathieu Lafrance reports that the following will work. It's a
dog's breakfast, but you don't have
to understand it to use it. Thank you, Mathieu.
#include <windows.h>
void clrscr() {
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord = {0, 0};
DWORD count;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hStdOut, &csbi);
FillConsoleOutputCharacter(hStdOut, ' ', csbi.dwSize.X * csbi.dwSize.Y,
coord, &count);
SetConsoleCursorPosition(hStdOut, coord);
}