COMPROG

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Pseudocode

"Pseudo" means imitation or false and "code" refers to the instructions written in a programming language.

Scope of Definition

An algorithm applies to the following: ▪ Specific problem or class of problem ▪ The range of inputs has to be predefined ▪ The range determines the generality of the algorithm.

Integrity Clarity Simplicity Efficiency Modularity

Programming Characteristics

Sequence of Definition

The sequence in which the steps of the algorithm are to carried out should be clearly specified.

Continue

is a jump statement used inside loop. It skips loop body and continues to next iteration.

Source Code

A computer program in the form of a human readable

Programming Language

A computer program is written in

Flowchart

A graphical representation of the sequence of operations in an information system or program.

+ - * / % ++ --

Adds two operands. Subtracts second operand from the first. Multiplies both operands. Divides numerator by de-numerator. Modulus Operator and remainder of after an integer division. Increment operator increases the integer value by one. Decrement operator decreases the integer value by one.

if-else statement

An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.

Programming Language

Aritificial Language designed to express computations that can be performed by a machine

Oval Parallelogram Rectangle Diamond Arrow

Beginning or an end of the program Denotes an Input Output Denotes a process to be carried out Denotes a decision branch to be made Denotes the direction of Logic Flow

& | ^ ~ << >>

Binary AND Operator copies a bit to the result if it exists in both operands. Binary OR Operator copies a bit if it exists in either operand. Binary XOR Operator copies the bit if it is set in one operand but not both. Binary One's Complement Operator is unary and has the effect of 'flipping' bits. Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand.

Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Assignment Operators

C language is rich in built-in operators and provides the following types of operators

Dennis Ritchie

C was developed by

&& | | !

Called Logical AND operator. If both the operands are non-zero, then the condition becomes true. Called Logical OR Operator. If any of the two operands is non-zero, then the condition becomes true. Called Logical NOT Operator. It is used to reverse the logical state of its operand. If a condition is true, then Logical NOT operator will make it false.

== != > < >= <=

Checks if the values of two operands are equal or not. If yes, then the condition becomes true. Checks if the values of two operands are equal or not. If the values are not equal, then the condition becomes true. Checks if the value of left operand is greater than the value of right operand. If yes, then the condition becomes true. Checks if the value of left operand is less than the value of right operand. If yes, then the condition becomes true. Checks if the value of left operand is greater than or equal to the value of right operand. If yes, then the condition becomes true. Checks if the value of left operand is less than or equal to the value of right operand. If yes, then the condition becomes true.

Efficiency

Concerned with execution speed and efficient memory utilization

Greatest Common Divisor - Euclid

First Algorithm

Break

In C programming, to terminate immediately from a loop or switch, we make use of

Input and Output Definition

Inputs - are the data items that is presented in the algorithm; An algorithm has zero or more inputs, taken from a specified set of objects.. Outputs - are the data items presented to the outside world as the result of the execution of a program based on the algorithm.

Effectiveness

It consists of basic instructions that are realizable; All operations to be performed must be sufficiently basic that they can be done exactly and in finite length.

If-else Statement

It is used to take an action based on some condition. For example - if user inputs valid account number and pin, then allow money withdrawal.

Simplicity

Keeping things as simple as it can be, conisitent with overall programm objectives

Modularity

Many program can be broken down into a series of identifiable subtask

Clarity

Refers to the overall readability of the program with emphasis on its underlying topic

= += -= *= /= %= <<= >>= &= ^= |=

Simple assignment operator. Assigns values from right side operands to left side operand Add AND assignment operator. It adds the right operand to the left operand and assign the result to the left operand. Subtract AND assignment operator. It subtracts the right operand from the left operand and assigns the result to the left operand. Multiply AND assignment operator. It multiplies the right operand with the left operand and assigns the result to the left operand. Divide AND assignment operator. It divides the left operand with the right operand and assigns the result to the left operand. Modulus AND assignment operator. It takes modulus using two operands and assigns the result to the left operand. Left shift AND assignment operator. Right shift AND assignment operator. Bitwise AND assignment operator. Bitwise exclusive OR and assignment operator. Bitwise inclusive OR and assignment operator.

Finiteness Absence of Ambiguity Sequence of Definition Input and Output Definition Effectiveness Scope Definition

Six Properties of Algorithm

Finiteness

The execution of a programmed algorithm must be complete after a finite number of operations have been performed. Otherwise, we cannot claim that the execution produces a solution.

Absence of Ambiguity

The representation of every step of an algorithm should have a unique interpretation which also understand by the human.

Integrity

This refer to the accuracy of calculation

Adobe Systems Google Applications Mozilla Firefox and Thunderbird MySQL Server Alias System - Autodesk Maya Winamp Media Player 12D Solutions Bloomberg RDBMS Callas Software Image Systems

Top 10 best applications written in C/C++

nested if statement

You can use one if or else if statement inside another if or else if statement(s).

Program

a collection of instruction that performs a specific task when executed by a computer.

Switch Statement

a control flow statement that tests whether a variable or expression matches one of a number of constant integer values, and branches accordingly

Algorithm

a sequence of finite instructions, often used in calculation and data processing

Operator

a symbol that tells the compiler to perform specific mathematical or logical functions.

C Conditional Statement

allow you to make a decision, based upon the result of a condition. These statements are called Decision Making Statements or Conditional Statements.

Pseudocode

another programming analysis tool that is used for planning a program.

C Programming

high-level and general-purpose programming language that is ideal for developing firmware or portable applications.

If Statement

if the test expression is evaluated to true, the statement block will get executed, or it will get skipped.

Goto Statement

used to branch unconditionally within a program from one point to another.

Compiler

used to translate source code from a programming language into either object code or machine code.

used when you have multiple possibilities for the if statement. Switch case will allow you to choose from multiple options.

used when you have multiple possibilities for the if statement. Switch case will allow you to choose from multiple options.


Set pelajaran terkait

Lehne Chapter 108 Practice Questions

View Set

Arithmetic Sequences, Geometric Sequences, Summation of Arithmetic Series

View Set

Chapter 32: Skin Integrity and Wound Care - Prep U

View Set