C++Lecture 1 Intro To Computers
C++Lecture 1 Intro To Computers
C++Lecture 1 Intro To Computers
Why Program ?
The computer is a tool that is used by many professionals and it can perform so many jobs
Why Computers ??
Computer Programmers ??
• Processor - CPU / Central Processing Unit-electronic : Controls the computer and how it works. It
consists of two basic parts: the ALU and the Control Unit.
• Secondary Memory - Slow, cheap, long-lasting ( Auxiliary Memory / Savable, infinite memory, non-
volatile, external storage). e.g. floppy disks, hard drives, CD, DVD, flash drives, etc.
• Registers
• Input/Output Devices
▪ Input: . Input devices take data and converts into information such as keyboard, mouse,
scanners, light pens, optical mark readers, voice recognizers, digital cameras,
microphones, etc.
▪ Output: monitors, printers, speakers, disk drives, voice synthesizers
For typical desktop computers, the processor, main memory, secondary memory, power supply, and
supporting hardware are housed in a metal case. Many of the components are connected to the main
circuit board of the computer, called the motherboard. The power supply supplies power for most of the
components. Various input devices (such as the keyboard) and output devices (such as the monitor) are
attached through connectors at the rear of the case.
Program or an algorithm
Instruction Cycle or Execution Cycle - How does the computer execute a program?
Software
Algorithm
• An algorithm is A step by step ordered procedure that solves a problem in a finite number of precise steps
Examples:
• Top-down design (hierarchy chart) : start with the overall task, then break down into progressively smaller
tasks ( Divide and Conquer Approach ).
Top-down design
Example :-
Programming Languages :-
▪ Machine Language: binary (1's and 0's), bits. They are machine specific.
▪ Low Level Language: Assembly Language - closer to the numeric machine language of the computer
than to natural language. Consist of letters and digits. Disadvantages:
• Machine dependent.
• Not close enough to natural language to be easily learned and understood.
• Require technical background (understanding of computer architecture).
Consist of Words, symbols, numbers - Easier for humans to read and use - Must be
translated to Machine Code.
• BASIC - met the need for simplicity; often used in an interactive environment
• FORTRAN - designed in the late 1950s to meet the needs of the scientific and
engineering communities
• COBOL - designed for business applications
• Pascal - introduced the concept of structured programming & special data types; a
teaching language
• C - a structured language developed at Bell Laboratories that allows low-level
programming while using a high-level style language
• C++ - a spin off of the C language also developed at Bell Labs that offers object
oriented features not found in C; portable
• Java - object-oriented language developed at Sun Microsystems used to develop
programs that run over the internet in a Web browser
• Visual Basic - a software development environment by Microsoft that allows
programmers to create Windows-based applications
• Python – general purpose languages created in early 1990’s. it has become popular in
both business and academic applications.
• Ruby – general purpose languages created in early 1990’s. it has become popular in
language for program that run on Web Servers.
Translation Process
Categories of Instructions
▪ Input
▪ cin >> hours
▪ gathers info from “outside world”
▪ Processing
▪ pay = hours * rate;
▪ computation
▪ Output
• cout << “How many hours did you work? “;
• sends info to “outside world”
Programming Process
Software Engineering is a branch of computer science. It deals with entire process of developing and
maintaining computer software :-
a. Analysis
b. Designing
c. Writing Code
d. Testing
e. Debugging
f. Documenting
g. Modifying (updating)
h. Maintaining (fixing bugs reported by users)
- Analyze the problem - Specify precisely what the solution requires - list data objects.
a. input values
b. constant values
c. output values
• Design
3. Construct an algorithm using pseudocode--a step by step ordered procedure that describes the
solution to a given problem in a finite number of precise steps.
• Documentation
• Modifying – Maintenance
• Obsolescence
C++
What is C++
Development
– Virtual functions
– Operator overloading
– Multiple Inheritance
– Templates
– Exception handling
CodeBlocks – Installation
Go to http://codeblocks.org
Click on Downloads
http://codeblocks.org/downloads/
Click on Binaries
Click on http://codeblocks.org/downloads/binaries
Click on http://codeblocks.org/downloads/binaries
codeblocks-20.03mingw-setup
Click on Next
Click on I Agree
Click on Next
Click on Install
Click on Yes
Select Finish
Type in Project title and chose to folder to create the project in then --- > next
Press on Finish
First , make sure that you rename the .cpp file from main.cpp to the
name that is given in the assignment then click ok. High light
main.cpp and change it be
LastName_FirstName_CS1428_PA1.cpp
Select Build:
Select Run: