Overview. What is Computer Programming? It is the process of planning a sequence of steps (called instructions) for a computer to follow. 2 STEP 1 STEP.

Slides:



Advertisements
Similar presentations
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
Advertisements

Overview of Programming and Problem Solving ROBERT REAVES.
Chapter 1: An Overview of Computers and Programming Languages
CS105 INTRODUCTION TO COMPUTER CONCEPTS INTRO TO PROGRAMMING Instructor: Cuong (Charlie) Pham.
1 Chapter 1 Introduction to Object-Oriented Programming.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex.
This set of slides is provided by the author of the textbook1 Introductory Topics l Computer Programming l Programming Life-Cycle Phases l Creating an.
Chapter 1 Introduction to Object- Oriented Programming and Problem Solving.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Chapter 1: An Overview of Computers and Programming Languages
Programming Fundamentals (750113) Ch1. Problem Solving
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems/Headington Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
PRE-PROGRAMMING PHASE
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages Updated by: Dr\Ali-Alnajjar.
CS 115 Chapter 1 Overview of Programming and Problem Solving.
1 Chapter 1 Overview of Programming and Problem Solving Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
1 Author: Nell Dale Chip Weems Mark Headington Published By Higher Education Press Jones and Bartlett Publishers.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
CHAPTER 1 Overview of Programming and Problem Solving.
1 Overview of Programming and Problem Solving Chapter 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
Introduction to Algorithms By Mr. Venkatadri. M. Two Phases of Programming A typical programming task can be divided into two phases: Problem solving.
What is programming? Steps to solve a problem. Repeatable by executing or “doing” the steps again. UWP - Landgraf Some slides are from Dr. Qi Yang's notes.
Overview of Programming and Problem Solving Textbook Chapter 1 1.
Software Life Cycle What Requirements Gathering, Problem definition
The Development Process Problem Solving. Problem Solving - Dr. Struble 2 What Is Asked of Computer Programmers? Input Transformation Output Write a computer.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
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.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems/Headington.
Chapter 1 Overview of Programming and Problem Solving Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
Lecture 11: 10/1/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Name the United States Coins Count the Pennies 10 ¢
Chapter 1 Overview of Programming and Problem Solving 1.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex.
1 Chapter 1 Overview of Programming and Problem Solving Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Chapter 1 Overview of Programming and Problem Solving CS185/09 - Introduction to Programming Caldwell College.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
1 Chapter 1 Programming Languages Evolution of Programming Languages To run a Java program: Java instructions need to be translated into an intermediate.
1 Overview of Programming Principles of Computers.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
Introduction to Programming By: Prof. Muhammad Abu Baker Siddique 2 nd Lecture 1.
1 Chapter 1 Overview of Programming and Problem Solving Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
Introduction to Computers and C++ Programming
Programming Languages
Computer Programming.
Programming Fundamentals (750113) Ch1. Problem Solving
Name the United States Coins
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Computer Programming.
What is Computer Programming?
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Presentation transcript:

Overview

What is Computer Programming? It is the process of planning a sequence of steps (called instructions) for a computer to follow. 2 STEP 1 STEP 2 STEP 3...

Programming Life Cycle Phases Problem-Solving Implementation Maintenance 3

Problem-Solving Phase Analyze the problem and specify what the solution must do Develop a general solution(algorithm) to solve the problem Verify that your solution really solves the problem 4

Algorithm An algorithm is a finite list of step-by-step instructions for solving a problem. It can be presented by Pseudo Code If score is positive Add score to Total Else Display an error message How to put an elephant into a fridge?

Example Problem: Coin Counting I have 100 coins (quarter, dime, nickel and penny only), and I want to figure out how much their total value is. Count and add the coins one by one. Divide the coins into four piles (quarter, dime, nickel and penny), then count them separately. Sum the values of the four piles. What will you do? OR Which one is better? (for human and for computer)

Example Problem: Coin Counting Count and add the coins one by one. Algorithm : 1) Read coin 2) Add the coin value to the summed value 3) Repeat Step 1) and 2) if # of coins counted is not 100 yet

Example: Triangle The triangle program accepts 3 integers: a, b and c, which are taken to be sides of a triangle. The output of the program is the type of triangle determined by the three sides: Equilateral, Isosceles, Scalene, or NotATriangle. Can you write an algorithm for this problem?

What is a programming language? It is a language (just like English, German,…) with strict Grammar rules Symbols Special words that can be interpreted by a computer (compiler to be exact).

Example Program int numCoin = 0; float sumValue = 0; string coinType; while ( numCoin < 100 ) { cin >> coinType; if ( coinType == "quarter" ) sumValue = sumValue ; if ( coinType == "dime" ) sumValue = sumValue + 0.1; if ( coinType == "nickel" ) sumValue = sumValue ; if ( coinType == "penny" ) sumValue = sumValue ; numCoin = numCoin + 1; } Note: This is NOT a complete program! Let’s try if it works. Do you understand?

High-level programming language more like a nature language (You almost understand it!) C++ Java C C# PHP similar to English But computers don’t understand it!

Low-level programming language machine language (computer’s native language) machine specific, not portable composed of 0 and 1’s assembly language: symbolic representation of the machine codes Add AX, Score

Running a program We need to translate the C++ program into machine code! other code from libraries, etc. other code from libraries, etc. written in machine language written in machine language written in machine language written in machine language written in C++ written in C++ via compiler via linker SOURCEOBJECT EXECUTABLE Lab0.cppLab0.objLab0.exe

Always solve the problem before writing the program!

15 Problem Solving Techniques Ask questions what is the input data? what should be the output? what if …? Look for familiar things find the cheapest product in the inventory find the coldest day of the year Solve by analogy how to play tennis? I know how to play badminton. It’s similar! Use means-ends analysis determine the I/O and then work out the details A  B, how?

Problem Solving Techniques For a large problem: divide and conquer building-block approach merging solutions How to build a house?