310201 Fundamental Programming Final Review
The place of programming The software development life cycle Analysis of problem Specification Design of algorithm Coding of program Testing and Debugging Documentation Maintenance
The five types of statement Input Output Assignment Selection Repetition
Selection If … Else … Switch
if-else statement if ((Age < 18) && (Sex=‘M’)) { cout << “A male child“ << endl; } else cout << “A male adult“ << endl;
Switch statement switch ( CharMenuSelection ) { case 'a': case 'A': ProcessSelectionA; break; case 'b': case 'B': ProcessSelectionB; default: ProcessOther; }
Repetition While loops Do … While loops For loops
While loop Sum = 0 ; Number = 5; while (Number > 0) { } cout << “The sum is “ << Sum << endl;
do-while loops if a task must be performed at least once, we can perform the test at the end of the loop using do-while do { cout << “Select a number between 1 and 5“; cin >> Num; } while ((Num<1) || (Num>5));
For loops for ( int Counter = 0; Counter < 5; Counter++ ) { cout << “Counter = “ << Counter << endl; }
Operators Arithmetic +, -, *, /, % Relational ==, !=, >, >=, <, <= Logical &&, ||, !
Variable Types Integer – int, long Floating point – float, double Character – char Boolean - bool
Modularization (1) Functions Library functions Function headers Prototypes Calling functions
Modularization (2) Global Variables Local Variables Parameters and Arguments Passing by Reference Passing by Value Return Values
Arrays Declaring Arrays Using Arrays Passing Arrays to Functions Strings Multidimensional Arrays
Summary We’ve finished!