0% found this document useful (0 votes)
718 views

Reviewer in Computer Programming 1

The document provides an overview of computer programming concepts including: - Programming involves giving step-by-step instructions to computers using code written in a programming language. Common programming languages include C++. - There are different types of programming languages from low-level like machine language to high-level languages that are more human-readable like Python. - The process of developing a program involves analyzing requirements, designing the system, coding, testing and debugging, and documentation. Key concepts like algorithms, pseudocode, and flowcharts are used in this development process. - Programming paradigms like procedural and object-oriented approaches influence how programs are written. Core components of C++ as an extension of C are

Uploaded by

kyyclasses
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
718 views

Reviewer in Computer Programming 1

The document provides an overview of computer programming concepts including: - Programming involves giving step-by-step instructions to computers using code written in a programming language. Common programming languages include C++. - There are different types of programming languages from low-level like machine language to high-level languages that are more human-readable like Python. - The process of developing a program involves analyzing requirements, designing the system, coding, testing and debugging, and documentation. Key concepts like algorithms, pseudocode, and flowcharts are used in this development process. - Programming paradigms like procedural and object-oriented approaches influence how programs are written. Core components of C++ as an extension of C are

Uploaded by

kyyclasses
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

REVIEWER IN COMPUTER PROGRAMMING 1

Module 1: Introduction to Programming

 Programming - a multistep process for creating a program.


- way of giving computers instructions about what they should do next.
- Instructions are called code.
- important for learning to innovate, create eco-friendly solutions for global problems, and
speeding up the input and output processes in a machine.
 Computer program - list or sequence of instructions that tell a computer what to do.
 Programming language (PL) – where a computer program is written.
- a type of written language that tells computers what to do in order to work.
 Syntax – grammar of the programming language
- consists of rules governing the structure and content of the statement that should be
followed.
 Programmer - writes source code using a programming language to create programs.
 Source code - a well-written set of instructions and statements to develop a program.
- can be written in low-level or high-level language.
- must be translated to machine language (binary form) using a language translator.
 Assembler - translates a program written from an assembly language to a low-level language.
 Interpreter - translates each statement or one line at a time and executed immediately after
translation.
- Example: JavaScript, Python, Ruby
 Compiler - translates all statements at one time. It provides all the error messages – called
diagnostics- at once.
- Example: C, C++, Java
 Integrated Development Environment (IDE) - a software application that allows programmers
and offers the tools needed for them to code and test a software.

Low Level Language vs High Level Language

 Low-level Language - uses instructions tied directly to one type of computer.


- often cryptic and not human-readable.
- Examples: machine language, assembly language
 High-level language - uses English-like instructions and can be run on a variety of computer
types.
- Examples: Visual Basic, C, C++, Java

 Machine Language - Instructions written in 0s and 1s


- all data is represented by microscopic electronic switches that can be either OFF or ON
(OFF= 0, ON = 1)
 Assembly Language - programming language with symbolic names for opcodes, and decimals or
labels for memory addresses
- must be translated into machine instructions, using an assembler.
 Programming paradigm - a style, or “way,” of programming to solve problem using some
programming language.
- an approach or method to solve a problem using tools and techniques.
 Procedure-oriented program - programmer concentrates on the major tasks that the program
needs to perform.
- programmer must instruct the computer every step of the way, from the start of the task to
its completion.
 Object-oriented program - requires the programmer to focus on the objects that the program
can use to accomplish its goal.
 Program Development Life Cycle - set of steps or phases that are used to develop a program in
any programming language.
 Phases – sequence of steps in program development.

Steps in Program Development

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.

Module 2: Program Logic Design and Formulation

 Algorithm - a procedure or formula for solving a problem, based on conducting a sequence of


specified actions.
- can be expressed using pseudocode or flowchart.
 Write the algorithm in the Processing column of the Input-Process-Output (IPO) chart.
 Each instruction should start with a verb.
 Most algorithms begin with instruction to enter the input items into the computer.
 Next, record instructions to process the input items to achieve the problem’s output.
 Most algorithms end with instruction to display, print, or store the output items.
 Pseudocode – also called false code because it has no syntax like any of the programming
language and thus can’t be compiled or interpreted by the computer.
- simply an implementation of an algorithm in the form of annotations and informative text
written in plain English.
- not standardized.
- Keywords - used to indicate common input-output and processing operations.
- written fully in uppercase.
1. START: This is the start of your pseudocode.
2. INPUT, ENTER, READ / GET: This is data retrieved from the user through typing or
through an input device.
3. PRINT, OUTPUT, DISPLAY, SHOW: This will show your output to a screen or the relevant
output device.
4. COMPUTE, CALCULATE, DETERMINE: This is used to calculate the result of an
expression.
5. SET, INIT: To initialize values.
6. INCREMENT, BUMP: To increase the value of a variable.
7. DECREMENT: To reduce the value of a variable.
- Common Operators
1. Assignment: ← or :=
2. Arithmetic: +, −, ×, /, mod
3. Comparison (Relational): =, ≠, <, >, ≤, ≥
4. Logical: and, or
- KEYWORDS in CONDITIONAL
1. IF — THEN – ENDIF
2. IF – ELSE IF — ENDIF
3. IF — ELSE IF — ELSE – ENDIF
4. CASE – OTHERS – ENDCASE
- KEYWORDS in ITERATION/LOOPING:
- To iterate is to repeat a set of instructions in order to generate a sequence of outcomes.
1. WHILE condition sequence ENDWHILE
2. FOR iteration bounds sequence ENDFOR
3. DO sequence WHILE condition
 Flowchart - a pictorial representation of an ordered, step-by-step solution to a problem.
- can be used to express different structures:
 sequence
 selection/conditional
 loop
- Program Flowchart - a diagram that uses a set of standard graphic symbols to represent the
sequence of coded instructions fed into a computer, enabling it to perform specified logical
and arithmetical operations.
Module 3: Introduction to C++ Programming

 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++

• Character Set - that can be used in a program are:

 Lowercase letters (a-z)


 Uppercase letters (A-Z)
 Digits (0-9)
 Special Characters (+,-,*,/,=,(,),{,}......)

• Keywords - reserved words with special meaning in C++.

- Examples: double, int, char, switch, if, return, break, void

• 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.

- Conditional/Ternary Operators – also called as ternary operators.


- conditional operators ? and : are used to construct conditional expressions.

Module 4: Basic Input/Output Statements

 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.

Common Math Functions - <math.h> header

 pow() - used to find the power of the given number.


 sqrt() - returns the square root of value.
 abs() – used to calculate the absolute value for integer type numbers.
 fabs() - used for floating type numbers.
 ceiling() - greatest preceding integer.
 floor() - least succeeding integer.
 trunc() - used to round (truncate) the value toward zero and returns the nearest integral value.
 round() - used to round the given number to the closest integer.
 tan() - returns the tangent of arg.
 Setprecision - when used along with ‘fixed’ provides precision tofloating point numbers correct
to decimal numbers mentioned in the brackets of the setprecision.
- part of <iomanip> header.

Qz2comP

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy