Introduction to Computers and C++ Programming

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 1.
Advertisements

Chapter 1: An Overview of Computers and Programming Languages
COSC 120 Computer Programming
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Computers and C++ Programming.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Chapter 1 Introduction to Computers and C++ Programming.
Three types of computer languages
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
CS211 Data Structures Sami Rollins Fall 2004.
Computer Programming 1 Problem Solving and Software Engineering.
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages Updated by: Dr\Ali-Alnajjar.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1 Introduction to Computers and C++ Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Computers and C++ Programming.
Copyright © 2015 Pearson Education, Ltd.. All rights reserved. Chapter 1 Introduction to Computers and C++ Programming.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1 Introduction to Computers and C++ Programming.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Computers and C++ Programming.
Chapter 1 Introduction to Computer and C++ Programming.
Copyright © 2015 Pearson Education, Ltd.. All rights reserved. Chapter 1 Introduction to Computers and C++ Programming.
Mohamed Iqbal Pallipurath Slide 1. Mohamed Iqbal Pallipurath Slide 2 Basics Introduction to Computers and C++ Programming.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
1 Problem Solving with C++ The Object of Programming Walter Savitch Chapter 1 Introduction to Computers and C++ Programming Slides by David B. Teague,
Overview of Programming and Problem Solving Textbook Chapter 1 1.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
CS CS CS IA: Procedural Programming CS IB: Object-Oriented Programming.
Copyright © 2012 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Computers and C++ Programming.
CS Computer Science I. BCPL was developed in 1967 as a language for writing operating systems and software compilers In 1970, the creators of the.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
12/18/2015 CSI Chapter 1 1 Compiler + Linker = Ready to run code Compiler translates high-level language source code into an intermediate object.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Computers and C++ Programming.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. Chapter 2 C++ Basics.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
Chapter 1: Introduction to Computers and Programming
Foundations of Computer Science C & C++ programming lecture 2
Introduction to Computers and C++ Programming
Chapter 1: An Overview of Computers and Programming Languages
Introduction to Computers and C++ Programming
Engineering Problem Solving With C An Object Based Approach
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Chapter 1: Introduction to Computers and Programming
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
CS IA: Procedural Programming CS IB: Object-Oriented Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Introduction to Computers and C++ Programming Chapter 1

Main Components of a Computer CPU Main memory 00011111 10101100 11100011 Input device(s) Output device(s) Secondary memory

Bytes and Addresses 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.

Computer Systems Hardware Software PCs Workstations Mainframes Operating System Programs

What is a program? 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.

Languages High Level Languages Low Level Languages C++ Java Assembly Language Add X Y Z Machine Language 00011101

Compilers Programs that translate a high-level language like C++ to a machine-language that the computer can directly understand and execute.

Preparing a C++ program for Running Source Code Object code for other routines Compiler Object code for C++ program Linker

Program Design Process Problem-solving phase Implementation phase Start Translating to C++ Problem definition Testing Algorithm design Desktop testing Working Program

The Software Development Method 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 Life Cycle Analysis and specification of the task (problem definition) Design of the software (algorithm design) Implementation (coding) Testing Maintenance and evolution of the system Obsolescense

Introduction to C++ BCPL B programming language C programming language Dennis Ritchie 1970s C++ Bjarne Stroustrap 1980s

Layout of a C++ Program #include <iostream> using namespace std; int main() { Variable_Declarations Statement_1 Statement_2 … Statement_Last return 0; } Program starts here Program ends 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 executable statements return statement

Sample 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; }

Compiling and Running a C++ Program

Testing and Debugging Bug Debugging A mistake/error in the program 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

Sample C++ Program 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; }