REVIEW FOR MIDTERM

COVERAGE

Lecture notes: all
Text: Chapters 1, 2 and Sections 3.1-3.9 of Chapter 3

SUMMMARY OF IMPORTANT TOPICS YOU SHOULD KNOW AT THIS POINT

COMPUTERS & PROGRAMMINGING LANGUAGES
Computer: input unit, output unit, memory unit, ALU, CPU, secondary storage unit
Programming language: machine language, assembly language, high-level language
Structured programming language
Object-oriented programming language
C++ is both a structured and object-oriented programming language

PLATFORM: MS VISUAL C++ INTEGRATED DEVELOPMENT ENVIROMENT (IDE)
Editor
Compiler
Linker
Execution
Source code (stored in file with extension .cpp)
Object code
Executable code

BUGS
Syntax errors
Run-time errors
Logical errors

DESIGNING YOUR PROGRAM
Top-down design (stepwise refinement)
Algorithm
Programmer's Algorithm:
1. Define problem
2. Plan the problem solution using top-down design
3. Code the program
4. Test and debug the program
5. Document the program

Recommendation: Design your program in stages. At each stage you should have a working program. Don't include all the details (bells and whistles) in your initial program, but instead at each stage add on a few features and debug. It is a good idea to keep each of the development stages of your program in separate files, so you can go back to an earlier version if need be.

GOOD PROGRAMMING STYLE Comments
User-friendly prompts
Descriptive variable names
Proper indentation
etc.

C++ PROGRAM
Comments
Preprocessor
Preprocessor directive #include
Header file
Organization of a C++ program: Preprocessor section, Main function section
Output: cout, escape sequences, e.g., \n
Input: cin

DATA CLASSES
Class
Object
ADT (Abstract Data Type)
Standard Data Classes
1. Integer class: short, int, unsigned int, long, unsigned long
2. Floating point class: float, double, long double
3. Character class: char, unsigned char, ASCII
4. Character string class
5. Boolean class

CONSTANT AND VARIABLE OBJECTS
Defining (declaring) constant objects
Defining (declaring) variable objects

OPERATIONS ON STANDARD CLASSES
Arithmetic operations: +, -, *, /, %
Integer operations vs. floating point operations
Example: Computing average
Order of precedence
Increment and decrement Operators: ++, --
Assignment operators: =, +=, *=, etc.
Boolean relational operators: ==, !=, <, <=, >, <=
Logical operators: !, ||, &&
Truth Tables

CONTROL STRUCTURES

1. sequential

2. selection

3. repetition

MODULAR PROGRAMMING & FUNCTIONS

CS121: Midterm Practice Exam


To study for the exam, you should go over all the materials available on the website, and your classnotes. In addition you should do most of the Self-Review Exercises in the Textbook in Chapters 1 and 2. The following exercises from the textbook are also recommended.
1.22, 1.23, 1.24, 1.25, 1.26
1.31, 1.32, 1.36
2.14, 2.15
2.20, 2.21, 2.28, 2.31, 2.33
2.35, 2.36
2.40, 2.42
3.1 - 3.6
3.15 - 3.22 <\html>