SlideShare a Scribd company logo
1 of 21
Introduction to Computers
and C++ Programming
Lecture 1
Outline
Main Components of a Computer
Input device(s)
CPU
Main memory
Secondary memory
Output device(s)
00011111
10101100
11100011
• Main memory is divided into numbered locations called
bytes.
• The number associated with a byte is called its address.
• A group of consecutive bytes is used as the location for a
a data item, such as a number or letter.The address of the
first byte in the group is used as the address of this larger
memory location.
Bytes and Addresses
Computer Systems
Software
Operating
System
Programs
Haedware
PCs Workstations Mainframes
• A program is set of instructions for a computer to follow
• Whenever we give a computer both a program to follow
and some data for the program, we are said to be
running the program on the data, and the computer is
said to execute the program on the data.
What is a program?
High Level Languages
 C++
 Java
Low Level Languages
 Assembly Language
• Add XY Z
 Machine Language
• 00011101
Languages
Programs that translate a high-level language like C++ to
a machine-language that the computer can directly
understand and execute.
Compilers
C++ program
Source Code
Compiler
Object code for C++
program Linker
Object code for
other routines
Preparing a C++ program for Running
Problem-solving phase Implementation phase
Start
Problem
definition
Algorithm
design
Desktop
testing
Translating
to C++
Testing
Working
Program
Program Design Process
1. Specify the problem requirements.
2. Analyze the problem.
Input:
Output:
Formulas:
3. Design the algorithm to solve the problem.
4. Implement the algorithm.
5.Test and verify the completed program.
6. Maintain and update the program.
The Software Development
Method
1. Analysis and specification of the task (problem
definition)
2. Design of the software (algorithm design)
3. Implementation (coding)
4. Testing
5. Maintenance and evolution of the system
6. Obsolescense
The Software Life Cycle
BCPL
B programming language
C programming language
C++
• Dennis Ritchie
• 1970s
• Bjarne Stroustrap
• 1980s
Introduction to C++
#include <iostream>
using namespace std;
int main()
{
Variable_Declarations
Statement_1
Statement_2
…
Statement_Last
return 0;
} Program ends here
Program starts here
Layout of a C++ Program
#include <iostream>
using namespace std;
int main()
{
Variable_Declarations
Statement_1
Statement_2
…
Statement_Last
return 0;
}
include directive
standard namespace
main function
return statement
executable statements
Layout of a C++ Program
#include <iostream>
using namespace std;
int main()
{
int number1, number2, sum;
cout << "Enter first number: ";
cin >> number1;
cout << "Enter second number: ";
cin >> number2;
sum = number1 + number2;
cout << "Sum = " << sum << “n”;
return 0;
}
Sample C++ Program
Compiling and Running a C++
Program
Bug
A mistake/error in the program
Debugging
The process of eliminating bugs in a program
Testing and Debugging
• Types of program errors:
• Syntax errors
• Violations of the rules of the programming language
• Run-time errors
• Detected by computers when the program is run (numeric
calcualtions)
• Logic errors
• Mistakes in the underlying algorithm or translating the
algorithm into C++ language
Testing and Debugging
Try this:
Write a program that
displays the product
of two integers
#include <iostream>
using namespace std;
int main()
{
int number1, number2, product;
cout << "Enter first number: ";
cin >> number1;
cout << "Enter second number: ";
cin >> number2;
product =…………………..?
cout << “Product = " << product << “n”;
return 0;
}
Sample C++ Program
ThankYou

More Related Content

Similar to l1-introduction_to_computers_and_c_programming.pptx

Similar to l1-introduction_to_computers_and_c_programming.pptx (20)

Savitch ch 01
Savitch ch 01Savitch ch 01
Savitch ch 01
 
Savitch Ch 01
Savitch Ch 01Savitch Ch 01
Savitch Ch 01
 
Whole c++ lectures ITM1 Th
Whole c++ lectures ITM1 ThWhole c++ lectures ITM1 Th
Whole c++ lectures ITM1 Th
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
 
9781285852751 ppt c++
9781285852751 ppt c++9781285852751 ppt c++
9781285852751 ppt c++
 
Csc240 -lecture_3
Csc240  -lecture_3Csc240  -lecture_3
Csc240 -lecture_3
 
9781285852744 ppt ch01
9781285852744 ppt ch019781285852744 ppt ch01
9781285852744 ppt ch01
 
lec 1.pptx
lec 1.pptxlec 1.pptx
lec 1.pptx
 
ch01_an overview of computers and programming languages
ch01_an overview of computers and programming languagesch01_an overview of computers and programming languages
ch01_an overview of computers and programming languages
 
Unit ii
Unit   iiUnit   ii
Unit ii
 
C Programming
C ProgrammingC Programming
C Programming
 
Cse115 lecture02overviewofprogramming
Cse115 lecture02overviewofprogrammingCse115 lecture02overviewofprogramming
Cse115 lecture02overviewofprogramming
 
Chap 1 c++
Chap 1 c++Chap 1 c++
Chap 1 c++
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Computer programming and utilization
Computer programming and utilizationComputer programming and utilization
Computer programming and utilization
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
INTRODUCCIÓN A LA PROGRAMACIÓN
INTRODUCCIÓN A LA PROGRAMACIÓNINTRODUCCIÓN A LA PROGRAMACIÓN
INTRODUCCIÓN A LA PROGRAMACIÓN
 
Chap 2 c++
Chap 2 c++Chap 2 c++
Chap 2 c++
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 

Recently uploaded

The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 

Recently uploaded (20)

The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 

l1-introduction_to_computers_and_c_programming.pptx

  • 1. Introduction to Computers and C++ Programming Lecture 1
  • 3. Main Components of a Computer Input device(s) CPU Main memory Secondary memory Output device(s) 00011111 10101100 11100011
  • 4. • Main memory is divided into numbered locations called bytes. • The number associated with a byte is called its address. • A group of consecutive bytes is used as the location for a a data item, such as a number or letter.The address of the first byte in the group is used as the address of this larger memory location. Bytes and Addresses
  • 6. • A program is set of instructions for a computer to follow • Whenever we give a computer both a program to follow and some data for the program, we are said to be running the program on the data, and the computer is said to execute the program on the data. What is a program?
  • 7. High Level Languages  C++  Java Low Level Languages  Assembly Language • Add XY Z  Machine Language • 00011101 Languages
  • 8. Programs that translate a high-level language like C++ to a machine-language that the computer can directly understand and execute. Compilers
  • 9. C++ program Source Code Compiler Object code for C++ program Linker Object code for other routines Preparing a C++ program for Running
  • 10. Problem-solving phase Implementation phase Start Problem definition Algorithm design Desktop testing Translating to C++ Testing Working Program Program Design Process
  • 11. 1. Specify the problem requirements. 2. Analyze the problem. Input: Output: Formulas: 3. Design the algorithm to solve the problem. 4. Implement the algorithm. 5.Test and verify the completed program. 6. Maintain and update the program. The Software Development Method
  • 12. 1. Analysis and specification of the task (problem definition) 2. Design of the software (algorithm design) 3. Implementation (coding) 4. Testing 5. Maintenance and evolution of the system 6. Obsolescense The Software Life Cycle
  • 13. BCPL B programming language C programming language C++ • Dennis Ritchie • 1970s • Bjarne Stroustrap • 1980s Introduction to C++
  • 14. #include <iostream> using namespace std; int main() { Variable_Declarations Statement_1 Statement_2 … Statement_Last return 0; } Program ends here Program starts here Layout of a C++ Program
  • 15. #include <iostream> using namespace std; int main() { Variable_Declarations Statement_1 Statement_2 … Statement_Last return 0; } include directive standard namespace main function return statement executable statements Layout of a C++ Program
  • 16. #include <iostream> using namespace std; int main() { int number1, number2, sum; cout << "Enter first number: "; cin >> number1; cout << "Enter second number: "; cin >> number2; sum = number1 + number2; cout << "Sum = " << sum << “n”; return 0; } Sample C++ Program
  • 17. Compiling and Running a C++ Program
  • 18. Bug A mistake/error in the program Debugging The process of eliminating bugs in a program Testing and Debugging
  • 19. • Types of program errors: • Syntax errors • Violations of the rules of the programming language • Run-time errors • Detected by computers when the program is run (numeric calcualtions) • Logic errors • Mistakes in the underlying algorithm or translating the algorithm into C++ language Testing and Debugging
  • 20. Try this: Write a program that displays the product of two integers #include <iostream> using namespace std; int main() { int number1, number2, product; cout << "Enter first number: "; cin >> number1; cout << "Enter second number: "; cin >> number2; product =…………………..? cout << “Product = " << product << “n”; return 0; } Sample C++ Program