Programming
a technological process for telling a computer
which tasks to perform in order to solve
problems.
Programming ethics
1.Thou shalt not use a computer to harm other people.
2.Thou shalt not interfere with other people's computer work.
3.Thou shalt not snoop around in other people's computer files.
4.Thou shalt not use a computer to steal.
5.Thou shalt not use a computer to bear false witness.
6.Thou shalt not copy or use proprietary software for which you have not paid (without
permission).
7.Thou shalt not use other people's computer resources without authorization or proper
compensation.
8.Thou shalt not appropriate other people's intellectual output.
9.Thou shalt think about the social consequences of the program you are writing or the system
you are designing.
10.Thou shalt always use a computer in ways that ensure consideration and respect for other
humans
Programming Languages
 Programming is a skill that is becoming increasingly sought after in the job market.
Having at least a basic understanding of how software functions is helpful for anyone
who interacts with technology. With a background in programming, you can get a job
coding, designing software, data architecture, or creating intuitive user interfaces.
5 major types of programming languages
1. Procedural programming languages
A procedural language follows a sequence of statements or commands
in order to achieve a desired output. Each series of steps is called a
procedure, and a program written in one of these languages will have
one or more procedures within it. Common examples of procedural
languages include:
•C and C++
•Java
•Pascal
•BASIC
Programming Languages
 2. Functional programming languages
functional languages focus on the output of mathematical functions and
evaluations.
The result will vary depending on what data you input into the
function. Some popular functional programming languages include:
•Scala
•Erlang
•Haskell
•Elixir
•F#
3. Object-oriented programming languages (OOP)
This type of language treats a program as a group of objects composed of
data and program elements, known as attributes and methods. Objects can
be reused within a program or in other programs. This makes it a popular
language type for complex programs, as code is easier to reuse and scale.
Some common object-oriented languages include:
•Java
•Python
PHP
•C++
•Ruby
Programming Languages
 4. Scripting languages
Programmers use scripting languages to automate repetitive tasks,
manage dynamic web content, or support processes in larger
applications. Some common scripting languages include:
•PHP
•Ruby
•Python
•bash
•Perl
•Node.js
5. Logic programming languages
Instead of telling a computer what to do, a logic programming
language expresses a series of facts and rules to instruct the
computer on how to make decisions. Some examples of logic
languages include:
•Prolog
•Absys
•Datalog
•Alma-0
COMPILER
 A compiler is a special program
that translates a programming
language's source code into
machine code, bytecode or
another programming language.
The source code is typically
written in a high-level, human-
readable language such as Java
or C++.
NUMBER SYSTEM
 A value each digit in number can be determine using
the Digit
The position of the number
The base of the number system
The are several number systems that computer
Decimal
Binary
Octal
Hexadecimal
Binary system
 Bits
is the most basic unit of information in computing
and digital communications.
 Binary
is a way of representing data using 0s and 1s
Sample:
1 0 10 10 11
Decimal system
Uses digits from 0-9 to represent a
number with the base 10.
Next
History of C++
C++ was originally invented in 1979 by
the Danish developer Bjarne
Stroustrup
Line 1 //my first program using C++ language
Line 2 #include<iostream>
Line 3 using namespace std;
Line 4 int main ()
Line 5 {
Line 6 cout<<“I love programming!”;
Line 7 return 0;
Line 8 }
 This line begins with two slash signs,
indicating a comment. Any text that follows
these double slash will be ignored by the
compiler and will have no effect on the
program.
 Programmers put comments inside their C++
source code to serve as their notes or
bookmarks in the document.
 The hash symbol is a directive for the pre-
processor. It is not a regular code line with
expressions but an indicator for the compiler’s
pre-processor.
 Iostream means INPUT/OUTPUT STREAMS.
 The line means that all the elements of the
standard C++ library are declared within what
is called a namespace.
 This line declares the beginning of the
program or process because of the definition
of our function called main.
 The main function is the point by where all
C++ programs begin their execution,
dependent of its location within the source
code.
 This line indicates the beginning of the
program body. It is indicated by an opening
curly brace.
 This line is a C++ statement. A statement is a
piece of instruction that is executed inside the
body of any function. Statements make up the
body of any function.
 The line with a return code of 0 for the main
function is generally interpreted that the
program worked as expected without any error
during its execution.
 The return statement causes the main function
to finish.
 The closing curly brace indicates the end of
the program body.
 Comments are parts of the source code
disregarded by the compiler. In other words,
these lines serves as notes to the programmer.
 Double slash (//) tells the compiler to ignore
everything that follows the double slash until
the end of the line.
 Slash – star (/*) tells the compiler to ignore
everything that follows until it finds a star –
slash comment mark.
An identifier is the name of C++ entity
such as variables and functions. There
are rules in writing identifiers.
1. An identifier must begin with a letter of the alphabet.
2. The first character of the identifier may be followed
by any letter of the alphabet, any digit (0 – 9).
3. The identifier has no limit on the number of
characters it may have.
4. C++ is case – sensitive. The identifiers, Total, total,
and TOTAL are all different.
1. If an identifier consists of two or more words, we may
do any of the following:
• Use underscore to separate the words.
Example: total_amount amount_paid
• Capitalize the first character of each word except the
first.
Example: areaOfTriangle middleName
PROGRAM
#include <iostream>
using namespace std;
Int main ()
{
cout <<“Hello Worldn”;
return 0;
}

23-24-Quarter-1-Computer 8- Chapter1.pptx

  • 2.
    Programming a technological processfor telling a computer which tasks to perform in order to solve problems. Programming ethics 1.Thou shalt not use a computer to harm other people. 2.Thou shalt not interfere with other people's computer work. 3.Thou shalt not snoop around in other people's computer files. 4.Thou shalt not use a computer to steal. 5.Thou shalt not use a computer to bear false witness. 6.Thou shalt not copy or use proprietary software for which you have not paid (without permission). 7.Thou shalt not use other people's computer resources without authorization or proper compensation. 8.Thou shalt not appropriate other people's intellectual output. 9.Thou shalt think about the social consequences of the program you are writing or the system you are designing. 10.Thou shalt always use a computer in ways that ensure consideration and respect for other humans
  • 3.
    Programming Languages  Programmingis a skill that is becoming increasingly sought after in the job market. Having at least a basic understanding of how software functions is helpful for anyone who interacts with technology. With a background in programming, you can get a job coding, designing software, data architecture, or creating intuitive user interfaces. 5 major types of programming languages 1. Procedural programming languages A procedural language follows a sequence of statements or commands in order to achieve a desired output. Each series of steps is called a procedure, and a program written in one of these languages will have one or more procedures within it. Common examples of procedural languages include: •C and C++ •Java •Pascal •BASIC
  • 4.
    Programming Languages  2.Functional programming languages functional languages focus on the output of mathematical functions and evaluations. The result will vary depending on what data you input into the function. Some popular functional programming languages include: •Scala •Erlang •Haskell •Elixir •F# 3. Object-oriented programming languages (OOP) This type of language treats a program as a group of objects composed of data and program elements, known as attributes and methods. Objects can be reused within a program or in other programs. This makes it a popular language type for complex programs, as code is easier to reuse and scale. Some common object-oriented languages include: •Java •Python PHP •C++ •Ruby
  • 5.
    Programming Languages  4.Scripting languages Programmers use scripting languages to automate repetitive tasks, manage dynamic web content, or support processes in larger applications. Some common scripting languages include: •PHP •Ruby •Python •bash •Perl •Node.js 5. Logic programming languages Instead of telling a computer what to do, a logic programming language expresses a series of facts and rules to instruct the computer on how to make decisions. Some examples of logic languages include: •Prolog •Absys •Datalog •Alma-0
  • 6.
    COMPILER  A compileris a special program that translates a programming language's source code into machine code, bytecode or another programming language. The source code is typically written in a high-level, human- readable language such as Java or C++.
  • 7.
    NUMBER SYSTEM  Avalue each digit in number can be determine using the Digit The position of the number The base of the number system The are several number systems that computer Decimal Binary Octal Hexadecimal
  • 8.
    Binary system  Bits isthe most basic unit of information in computing and digital communications.  Binary is a way of representing data using 0s and 1s Sample: 1 0 10 10 11
  • 9.
    Decimal system Uses digitsfrom 0-9 to represent a number with the base 10.
  • 11.
    Next History of C++ C++was originally invented in 1979 by the Danish developer Bjarne Stroustrup
  • 14.
    Line 1 //myfirst program using C++ language Line 2 #include<iostream> Line 3 using namespace std; Line 4 int main () Line 5 { Line 6 cout<<“I love programming!”; Line 7 return 0; Line 8 }
  • 15.
     This linebegins with two slash signs, indicating a comment. Any text that follows these double slash will be ignored by the compiler and will have no effect on the program.  Programmers put comments inside their C++ source code to serve as their notes or bookmarks in the document.
  • 16.
     The hashsymbol is a directive for the pre- processor. It is not a regular code line with expressions but an indicator for the compiler’s pre-processor.  Iostream means INPUT/OUTPUT STREAMS.
  • 17.
     The linemeans that all the elements of the standard C++ library are declared within what is called a namespace.
  • 18.
     This linedeclares the beginning of the program or process because of the definition of our function called main.  The main function is the point by where all C++ programs begin their execution, dependent of its location within the source code.
  • 19.
     This lineindicates the beginning of the program body. It is indicated by an opening curly brace.
  • 20.
     This lineis a C++ statement. A statement is a piece of instruction that is executed inside the body of any function. Statements make up the body of any function.
  • 21.
     The linewith a return code of 0 for the main function is generally interpreted that the program worked as expected without any error during its execution.  The return statement causes the main function to finish.
  • 22.
     The closingcurly brace indicates the end of the program body.
  • 23.
     Comments areparts of the source code disregarded by the compiler. In other words, these lines serves as notes to the programmer.
  • 24.
     Double slash(//) tells the compiler to ignore everything that follows the double slash until the end of the line.  Slash – star (/*) tells the compiler to ignore everything that follows until it finds a star – slash comment mark.
  • 25.
    An identifier isthe name of C++ entity such as variables and functions. There are rules in writing identifiers.
  • 26.
    1. An identifiermust begin with a letter of the alphabet. 2. The first character of the identifier may be followed by any letter of the alphabet, any digit (0 – 9). 3. The identifier has no limit on the number of characters it may have. 4. C++ is case – sensitive. The identifiers, Total, total, and TOTAL are all different.
  • 27.
    1. If anidentifier consists of two or more words, we may do any of the following: • Use underscore to separate the words. Example: total_amount amount_paid • Capitalize the first character of each word except the first. Example: areaOfTriangle middleName
  • 28.
    PROGRAM #include <iostream> using namespacestd; Int main () { cout <<“Hello Worldn”; return 0; }