Reviewer in Computer Programming 1
Reviewer in Computer Programming 1
1. Requirement Analysis
2. System Design
3. Coding or Writing the Program
4. Testing and Debugging
5. Documentation and Maintenance
Requirement Analysis - involves the collection of information and the definition of the
characteristics or features of the desired system.
- requirement - a description of what a system should do
- Problem Analysis requires performing the following steps:
Define the problem and the users.
Determine the desired outputs.
Determine the input to achieve the desired outputs.
Determine the processes involve.
Check the feasibility of implementing the program.
Document the analysis.
System Design - program design process describes the algorithm for the solution of the problem.
- algorithm - the step-by-step sequence of instructions that describe how data will be
processed to produce the desired output.
- pseudocodes or flowcharts – used to formulate the algorithm.
1. Pseudocode - an algorithm written in normal Human language statements to describe
the logic and processing flow.
2. Flowchart - a visual representation of the sequence of steps and decisions needed to
perform a process.
- diagram shape – where each step in the sequence is noted within.
- connecting lines and directional arrows – links the steps
Coding or Writing the Program - the actual writing of the program based on the design
specifications.
- Construction requires performing the following steps:
Select the appropriate programming language.
Follow the syntax.
Testing and Debugging
1. Desk checking - manually testing the solution design to make sure that it is free of errors
and that the logic works.
2. Debugging - detecting, locating, and removing all errors in a computer program.
3. Run real data
- Types of errors:
Syntax Error - the most common error and incorrect use of programming language
statements.
- rules in the writing of statements are violated which causes the program
to fail to compile and run.
Run-time Error - a software error that occurs while a program is being executed.
Logical Error - mistake in a program's source code that results in incorrect or unexpected
behavior.
Documentation and Maintenance
- Documentation - a written detailed description of the programming cycle and specific facts
about the program.
- includes necessary instructions on the use and maintenance of the
program/software (product).
- Maintenance - any activity designed to keep programs error-free, up-to-date and in good
working condition.
C++ - is an extension of C.
- statically typed, compiled, general-purpose, case-sensitive, free-form programming
language that supports procedural, object-oriented, and generic programming.
- middle-level language, as it comprises a combination of both high-level and low-level
language features.
- developed by Bjarne Stroustrup starting in 1979 at Bell Labs in Murray Hill, New Jersey.
- enhancement to the C language and originally named C with Classes but later it was
renamed C++ in 1983.
Preprocessor directives - lines beginning with a hash or pound sign (#) are directives for
the preprocessor.
- tell the compiler to preprocess the source code before compiling.
- Examples: #include and #define
#include directive - instructs the compiler to add the contents of an include file into your
program during compilation.
#include <iostream> - includes the declarations of the basic standard input-output library in C++
- Examples: cin, cout
#include <math.h> - defines various mathematical functions and one macro.
- Examples: pow, sqrt
#define directive - used to define symbolic names and constants.
Comment Line - All lines beginning with two slash signs (//) are considered comments.
Block Comment - purpose is only to allow the programmer to insert notes or descriptions
embedded within the source code.
using namespace std; - all the elements of the standard C++ library are declared within what is
called a namespace, the namespace with the name std (standard).
int main () - a special function in all C++ programs; it is the function called when the program is
run.
{ and } - the open brace ({) indicates the beginning of main's function definition, and the closing
brace (}) indicates its end.
Program statement - statement is a simple or compound expression that can actually produce
some effect.
- meat of a program, specifying its actual behavior.
- each statement must be terminated by a semicolon (;).
Compound statement - also called a block, is a group of two or more C++ statements enclosed in
braces.
return 0; - defines the exit status of the process or application.
- terminates main( )function and causes it to return the value 0 to the calling process.
Elements of C++
• Data Types - used to tell the variables the type of data it can store.
Primitive Data Types - are built-in or predefined data types and can be used directly by the user
to declare variables.
- Example: int, char, float, and bool
Datatype Modifiers - are used with the built-in data types to modify the length of data that a
particular data type can hold. Data type modifiers available in C++ are:
- Signed
- Unsigned
- Short
- Long
Integer - used for storing (+/-) whole numbers.
Character - is used for storing characters.
Boolean - used for storing boolean or logical values.
- can store either true or false.
Floating Point - used for storing single precision floating point values or decimal values. -
keyword: float
Double Floating Point - used for storing double precision floating point values or decimal values.
- keyword: double
Void - represents a valueless entity or without any value.
- used for those function which does not returns a value.
Wide Character – also a character data type but this data type has size greater than the normal
8-bit datatype.
- Keyword: wchar_t
• Identifiers - name used to identify a variable, function, class, module, or any other user-defined item.
- starts with a letter A to Z or a to z or an underscore (_).
- followed by zero or more letters, underscores, and digits (0 to 9).
Variables - also known as user-defined identifier.
- a data storage location that has a value, which can change during program execution.
- can be given any name up to 31 characters in length.
- only letters, digits or underscores may follow the initial letter.
Constants - any expression that has a fixed value; cannot be changed during program execution.
- enclosed between single quotes.
- keyword: const
- String constants - enclosed by double quotation
- Integer numbers - specified as numerical (whole number) constants without fractional
components.
- Floating-point constants - require the use of decimal point.
• Operators - symbols that tell the compiler to perform specific mathematical or logical manipulations.
- Assignment - single equal sign (=) which means that the value on the right side of the
assignment expression.
- Arithmetic – addition, subtraction, multiplication, division, remainder division
- Compound Operators – add and assign ( += ) , subtract and assign ( -= ) , multiply and assign
( *= ) , divide and assign ( /= ) , modulo and assign ( %= )
- Increment / Decrement - increment operator ++ adds 1 to its operand; the decrement
operator -- subtracts 1 from its operand.
- Relational – allow the comparison of two or more numerical values, yielding a result based
on whatever the comparison is true(1) or false(0).
- Logical - used to combine two or more conditions or to complement the evaluation of the
original.
- Bitwise Operators - works on bits and perform bit-by-bit operation.
Input and output (I/O) operators - used to take input and display output.
- the operator used for taking the input is known as the extraction or get from operator (>>).
- the operator used for displaying the output is known as the insertion or put to operator (<<).
Standard C++ library includes the header file iostream.
Insertion operator (<<) - commonly known as the output operator.
- The standard output by default is the screen, and the C++ stream object defined to access it
is cout.
Extraction operator (>>) - commonly known as the input operator.
- The standard input by default is the keyboard, and the C++ stream object defined to access
it is cin.
getline() - a standard library function in C++ and is usedto read a string or a line from input
stream.
Type Conversion - the process of converting one predefined type into another.
Implicit - also known as automatic type conversion; a conversion performed by the compiler
without programmer's intervention.
Explicit - user-defined that forces an expression to be of specific data type.
Type Casting - explicit conversion of an operand to a specific type.
Qz2comP