Sie sind auf Seite 1von 8

Material No. 1 Prepared By: Bob Mathew D.

Sunga

FUNDAMENTALS OF COMPUTER PROGRAMMING


OUTLINE
Introduction ........................................................................................................................................................... 2
Computer Language ............................................................................................................................................... 2
Basic Elements of a Language ............................................................................................................................. 2
A Computer Program.............................................................................................................................................. 2
Compiling ........................................................................................................................................................... 3
IDE ..................................................................................................................................................................... 3
Algorithm ........................................................................................................................................................... 3
Pseudocode........................................................................................................................................................ 3
Flowchart ........................................................................................................................................................... 3
Source Code ....................................................................................................................................................... 3
Programming Disciplines ........................................................................................................................................ 3
Traditional Procedural Programming - ................................................................................................................ 3
Object Oriented Programming - .......................................................................................................................... 3
The C++ Language .................................................................................................................................................. 4
C++ and C ........................................................................................................................................................... 4
APPENDICES ........................................................................................................................................................... 5
FLOWCHART ICONS ............................................................................................................................................ 5
Sample Flow Chart .......................................................................................................................................... 5
A Sample C++ Code ............................................................................................................................................. 6
Guide Questions ..................................................................................................................................................... 7
Bibliography ........................................................................................................................................................... 7
Exercise ...................................................................................................................... Error! Bookmark not defined.

ComProg 101 1 Fundamentals of Computer Programming


Material No. 1 Prepared By: Bob Mathew D. Sunga

INTRODUCTION
This course is about creating computational procedures and processes. In today’s world, computer
processes are a pivotal part of any organization to make it more efficient in its production, make
tasks simpler, and create systematic implementations. We also need computational processes for
computing functions, and for performing computational tasks. The building block of these
computer processes are called programs.

The following factors in programming greatly affect computational processes:

1. Modeling:
a. How good is the description/understanding of the computational process;
b. How it is split and combined from simpler processes;
c. How clear are the structures used;
d. How natural is the organization of the process;
2. Language:
a. Does it support the needed structures;
b. Does it enable high level thinking, i.e., abstraction, ignoring irrelevant
details;
c. Does it enable modular construction;

COMPUTER LANGUAGE
Computers understand a language variously known as computer language or machine language.
It’s possible but extremely difficult for humans to speak machine language. Therefore, computers
and humans have agreed to sort of meet in the middle, using intermediate languages such as C++.
Humans can speak C++ (sort of), and C++ is converted into machine language for the computer to
understand.

BASIC ELEMENTS OF A LANGUAGE


- Semantics – refers to the words itself and its associated meaning. This also refers to the
vocabulary of commands that humans can understand and that can be converted into
machine language.
- Syntax – refers to the structure, arrangement, the use of punctuations and other markings to
convey a meaning. This also refers to the grammar that allows humans to combine keywords
to execute a certain task.
- Primitive expressions – the most basic process or declaration of values.
- Composite expression – a combination or a collection of primitive expressions to execute an
operation or a procedure.
- Abstractions and Reference – this refers to the use of expressions to declare a variable, a
constant, or a certain object.

A COMPUTER PROGRAM
This refers to a sequence of expressions or commands that can be converted into a machine-
language that can actually does what we want done.

ComProg 101 2 Fundamentals of Computer Programming


Material No. 1 Prepared By: Bob Mathew D. Sunga

COMPILING – The act of converting a computer language into a machine


understandable language. This also refers to creating an executable program which can
be understood by the machine to perform arithmetic tasks.

IDE – or an integrated development environment is the tool or software application that


provides a comprehensive facilities to computer programmers for software development.

ALGORITHM – refers to the set of instructions, procedures, or formulas used to solve a


particular problem.

PSEUDOCODE – refers to a way a certain code should be executed. This can also be
referred to as the stenography of the source code.

FLOWCHART – a formalized graphic representation of a logic sequence, work, or


manufacturing process, organization chart, or similar formalized structure.

SOURCE CODE – refers to the programming statements that are created by a


programmer with a text editor or a visual programming tool then saved in a file.

Programming Disciplines
With the further development of the society, complexity in technology also arises. This also pose
a great challenge among programmers and developers alike in implementing procedures and
techniques in creating automation while getting the most efficient results.

TRADITIONAL PROCEDURAL PROGRAMMING - In traditional, procedural programming,


data and functions (subroutines, procedures) are kept separate from the data they process. This
has a significant effect on the way a program handles data:
- the programmer must ensure that data are initialized with suitable values before use
and that suitable data are passed to a function when it is called;
- If the data representation is changed, e.g. if a record is extended, the corresponding
functions must also be modified. Both of these points can lead to errors and neither
support low program maintenance requirements.

OBJECT ORIENTED PROGRAMMING - Object-oriented programming shifts the focus of


attention to the objects, that is, to the aspects on which the problem is centered. A program
designed to maintain bank accounts would work with data such as balances, credit limits, transfers,
interest calculations, and so on.

ComProg 101 3 Fundamentals of Computer Programming


Material No. 1 Prepared By: Bob Mathew D. Sunga

THE C++ LANGUAGE


In the early 1970s, a consortium of really clever people worked on a computer system called
Multix. The goal of Multix was to give all houses inexpensive computer access to graphics, e-mail,
stock data, pornography (just kidding), whatever. Of course, this was a completely crazy idea at
the time, and the entire concept failed.

A small team of engineers working for Bell Labs decided to save some portion of Multix in a very
small, lightweight operating system that they dubbed Unix (Un-ix, the single task version of Mult-
ix, get it?). Unfortunately for these engineers, they didn’t have one large machine but a number of
smaller machines, each from a different manufacturer.

The standard development tricks of the day were all machine-dependent — they would have to
rewrite the same program for each of the available machines. Instead, these engineers invented a
small, powerful language named C. C caught on like wildfire. Eventually, however, new
programming techniques (most notably object-oriented programming) left the C programming
language behind. Not to be outdone, the engineering community added equivalent new features
to the C language. The result was called C++.

C++ AND C
C++ is derived from the C language. Strictly speaking, it is a superset of C: Almost every
correct statement in C is also a correct statement in C++, although the reverse is not true.
The most important elements added to C to create C++ concern classes, objects, and
object-oriented programming. (C++ was originally called “C with classes.”) However, C++
has many other new features as well, including an improved approach to input/output
(I/O) and a new way to write comments. Figure 1.7 shows the relationship of C and C++.

In fact, the practical differences between C and C++ are larger than you might think.
Although you can write a program in C++ that looks like a program in C, hardly anyone
does. C++ programmers not only make use of the new features of C++, they also
emphasize the traditional C features in different proportions than do C programmers. If
you already know C, you will have a head start in learning C++ (although you may also
have some bad habits to unlearn), but much of the material will be new.

ComProg 101 4 Fundamentals of Computer Programming


Material No. 1 Prepared By: Bob Mathew D. Sunga

APPENDICES
FLOWCHART ICONS

SAMPLE FLOW CHART

ComProg 101 5 Fundamentals of Computer Programming


Material No. 1 Prepared By: Bob Mathew D. Sunga

A SAMPLE C++ CODE


Temperature Converter

OUTPUT

ComProg 101 6 Fundamentals of Computer Programming


Material No. 1 Prepared By: Bob Mathew D. Sunga

A more basic example

OUTPUT

GUIDE QUESTIONS:
1. What is the significance of learning computer programming? Site some concrete examples.
2. What is a computer language?
3. Explain what a computer program is.
4. What are the two disciplines in computer programming?
5. What is/are the main goal/s of the developers of C++?

BIBLIOGRAPHY
Davis, S. R. (2004). C++ For Dummies (5 ed.). Hoboken, NJ 07030-5774: Wiley Publishing, Inc. Retrieved 2018

Lafore, R. (2002). Object-Oriented Programming in C++ (4 ed.). Indianapolis, Indiana: Sams Publishing.

Nishadha. (2018, June 12). Ultimate Flowchart Guide ( Complete Flowchart Tutorial with Examples ). Retrieved from
Creately Blog: https://creately.com/blog/diagrams/flowchart-guide-flowchart-tutorial/

ZEYDAN, Ö. (n.d.). Introduction to Computer Programming. Retrieved from


http://cevre.beun.edu.tr/zeydan/pdf/introduction-to-computer-programming.pdf

ComProg 101 7 Fundamentals of Computer Programming


Material No. 1 Prepared By: Bob Mathew D. Sunga

QUIZ # 1
Name: ____________________________________________________________ Course: ____________

Answer the following questions.


1. Which of the following is/ are IDE? Select all that apply
a. Fortran d. Turbo C
b. Dev-C++ e. Java Script
c. Visual Studio f. Atom

2. Define the difference between natural language and machine language.


___________________________________________________________________________________
___________________________________________________________________________________
___________________________________________________________________________________
___________________________________________________________________________________

3. In your own opinion, is learning programming language important or not? Justify in 500 to 700 words.
Attach your answer on another paper. Write legibly or you may print it out.
Warning: I will be reading this and will check your grammar and idea. Should you copy your answer from another student, both
students will fail the subject automatically.
___________________________________________________________________________________

4. Create a flowchart wherein it will check whether the input is a prime number or composite. If
composite, show all factors.

5. Create a flowchart that will accept two Cartesian coordinate and will compute for the following:
a. distance d. Equation of the line perpendicular to
b. midpoint line c
c. equation of the line containing the
points

6. Create a flowchart that will simulate the nth term of a Tri-bonacci sequence.
- Bonus 1: for the person who can create a formula for the Nth term and give proof.
Example:
a1 = 1 a3 = (0 + a1 + a2) = 2
a2 = (0 + a1) = 1 a4 = (a1 + a2 + a3) = 4

Bonus 2: What is the origin of the terms “black-hat hacker” and “white-hat hacker”? Explain briefly.

Point system

Item Points Ruling RAW Item Points Ruling RAW


1 10 Points No partial points 5 25 0, 10, 20, 25
2 5 points No partial points 6 30 0, 15, 25, 30
3 10 points 0, 5, or 10 points Bonus 1 100 No partial points
4 20 points 0, 10, 15, 20 points Bonus 2 50 No partial points
TOTAL

Note: Unreadable writings will automatically be considered wrong. Messy papers will be considered a missed exam.

ComProg 101 8 Fundamentals of Computer Programming

Das könnte Ihnen auch gefallen