Lecture 4 Flashcards
First 4 parts of code
- Header/comment
- # include<iostream></iostream>
- Using namespace std;
- int main()
Preprocessor command
A command that the computer looks for and reads first. Starts with # and given to the compiler. Preprocess commands are commands to the compiler, so they don’t need ;.
3 preprocessor code examples
Include: brings in code with other files into the program
Define: can modify code
Ifdef: short for if defined, can choose lines of code
Namespace
A set of functions or commands in another file. Typically are downloaded with C++. If not included at the being of the program, needs to be written with two colons before each command.
Meaning of int main()
Int shows it returns an integer (0 for no error and a number for an error), main denotes the part of code to start with, and parentheses show it is a function.
Program requirements
The input, computations, and output needed.
Case test
Points of the program that need to be tested and the desired output.
Important points to test
Edge/boundary/corner cases (at a boundary), special case (errors that might be input or different than expected), normal case.