Computer Programming. Dr. Fahad Computer Science Deptt.

Similar documents
Chapter 1 Introduction to Computers and Programming

Week 0: Intro to Computers and Programming. 1.1 Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program?

A First Program - Greeting.cpp

Chapter 1: Why Program? Computers and Programming. Why Program?

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction

Introduction. Arizona State University 1

Understanding main() function Input/Output Streams

Input And Output of C++

4. Structure of a C++ program

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

assembler Machine Code Object Files linker Executable File

1a Computers, Problem Solving!

CS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6

Your First C++ Program. September 1, 2010

Data Structures and Programming with C++

CSC 126 FINAL EXAMINATION Spring Total Possible TOTAL 100

EP241 Computer Programming

Welcome to MCS 360. content expectations. using g++ input and output streams the namespace std. Euclid s algorithm the while and do-while statements

Programming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11

Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Scientific Computing

COMP322 - Introduction to C++ Lecture 01 - Introduction

Basic Computer Programming for ISNE. Santi Phithakkitnukoon ผศ.ดร.ส นต พ ท กษ ก จน ก ร

BITG 1113: Introduction To Computers And Programming Language LECTURE 1 LECTURE 1 1

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

Chapter 2: Introduction to C++

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

COURSE OUTLINE & WEEK WISE BREAKAGE

CHAPTER 3 BASIC INSTRUCTION OF C++

Computer Programming

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

LAB 4 Extending Signed and Unsigned Numbers

Midterm Practice Exam

LECTURE 02 INTRODUCTION TO C++

Getting started with C++ (Part 2)

Fundamentals of Structured Programming

CE221 Programming in C++ Part 1 Introduction

EEE145 Computer Programming

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING

VARIABLES & ASSIGNMENTS

6.096 Introduction to C++ January (IAP) 2009

I/O Streams and Standard I/O Devices (cont d.)

Chapter Two MULTIPLE CHOICE

CISC2000/ of 6

Chapter 2 Basic Elements of C++

Lab # 02. Basic Elements of C++ _ Part1

Pointers, Arrays and C-Strings

WARM UP LESSONS BARE BASICS

Sir Syed University of Engineering and Technology. Computer Programming & Problem Solving ( CPPS )

Fundamentals of Programming CS-110. Lecture 2

C++ Basics. Data Processing Course, I. Hrivnacova, IPN Orsay

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Object Oriented Design

The C++ Language. Arizona State University 1

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Chapter 1 INTRODUCTION

Chapter 2: Basic Elements of C++

Homework Assignment #2 (revised)

Introduction to C++ Chapter

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Lecture 23: Pointer Arithmetic

Overloading Functions & Command Line Use in C++ CS 16: Solving Problems with Computers I Lecture #6

C++ For Science and Engineering Lecture 12

Problem Solving and Program Design - Chapter 1. Cory L. Strope

CSE 333 Midterm Exam 7/25/16. Name UW ID#

EKT 120/4 Computer Programming KOLEJ UNIVERSITI KEJURUTERAAN UTARA MALAYSIA

CS302 - Data Structures using C++

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Java Basic Syntax. Java vs C++ Wojciech Frohmberg / OOP Laboratory. Poznan University of Technology

CSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York

Sample Final Exam. 1) (24 points) Show what is printed by the following segments of code (assume all appropriate header files, etc.

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Lab 2: Pointers. //declare a pointer variable ptr1 pointing to x. //change the value of x to 10 through ptr1

Computer Science II Lecture 1 Introduction and Background

Computer Programming : C++

PART I. Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++.

Topics. Functions. Functions

PIC 10A Pointers, Arrays, and Dynamic Memory Allocation. Ernest Ryu UCLA Mathematics

Lab 8 The Stack (LIFO) Structure

ME240 Computation for Mechanical Engineering. Lecture 4. C++ Data Types

Programming Fundamentals. With C++ Variable Declaration, Evaluation and Assignment 1

CSC 126 FINAL EXAMINATION FINAL Spring 2012 B. Name (last, First) Instructor. Total Possible. Received

CS 216 Fall 2007 Midterm 1 Page 1 of 10 Name: ID:

C++ Programming for Non-C Programmers. Supplement

pointers + memory double x; string a; int x; main overhead int y; main overhead

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement

Chapter 1: Introduction to Computers and Programming

C++ Structures Programming Workshop 2 (CSCI 1061U)

Review of Important Topics in CS1600. Functions Arrays C-strings

CSCE 110 PROGRAMMING FUNDAMENTALS

Unit 14. Passing Arrays & C++ Strings

The American University in Cairo Department of Computer Science & Engineeringt CSCI &09 Dr. KHALIL Exam-I Fall 2009

PIC 10A Miscellaneous

Transcription:

Computer Programming Dr. Fahad Computer Science Deptt.

Course Description This course provides the fundamental programming concepts. The emphasis will be on problem solving rather than just learning the programming language. Programming topics include control structures, functions, arrays, pointers, structures.

Intro to computer Brief Course outline C++ basics Selection and control structures User defined functions Mid Term Arrays Pointers Structures File handling Final Term Marking Distribution Quizzes 10% Assignments 5% Lab 15% Mid-Term 20% Project 10% Final 40% Total 100%

Recommended Books Deitel & Deitel, C++ How to Program, 5th Edition (or any latest) Robert Lafore, Object-Oriented Programming in C++, 3 rd /4 th Edition

requirements

Reference book

Contents Computer Hardware and Software Computer problems and problem solving Visual C++ environment First C++ program

Computer Hardware Input Processing Output

Input Devices

Output Devices

Processing

Memory Concepts Secondary Memory Hard disk, Floppy disk, CD/DVD Main memory/primary memory

Computer Organization Main memory vs. secondary memory. why ram and cache were introduced.

Computer Software is a collection of computer programs. e.g. Need for Speed, MS Office, Windows computer program vs. computer software

Types of Softwares System Softwares Application softwares Embedded softwares Scientific and Engineering softwares Business softwares

Number system Binary (1, 0) Octal (0-7) Decimal (0-9) Hexadecimal (0-9, A-F)

Bits & Bytes A bit is a single numeric value either 1 or 0. that encodes a single unit of digital information. A byte is a sequence of bits. 8bits=1byte.

Computer File

Networks Connected nodes/ devices for the purpose of sharing information and resources.

Communicate with computer Computer understands its own machine language (combo of 0s and 1s). Language instructs computer to perform tasks. We need to understand computer s language to communicate with it and to make it perform our desired functions. So we have.

High-Level & Low Level Languages Difference: It is easily understandable to human or not. High Level Language means the language is easily understandable, Uses English-like language Low Level Language means the language is more to a machine language than human understandable language.

Compiler is a computer program or set of programs that transforms source code to object code. Cross-Compiler DeCompiler Language ReWriter

Compilation process

Lexical analysis

Programming and Problem solving Algorithm A set of steps for solving a particular problem. Algorithms can be expressed in any language. From natural language (English or German) to high level language (VB, C++). Program An algorithm expressed in a language that computer can understand.

Program Design Process Problem solving phase Implementation phase

Program Errors Syntax errors Grammar/syntax error Run time errors during execution indicate bugs example: un-handled exceptions, memory overrun. logical errors Bug in program that causes program to operate incorrectly, but not terminate.

A simple C++ Program #include <iostream> void main (void) { cout << "Hello World!"; }

A simple C++ Program #include <iostream> void main (void) { cout << "Hello World!"; }

A simple C++ Program #include <iostream> void main (void) { cout << "Hello World!"; }

A simple C++ Program #include <iostream> void main (void) { } cout << "Hello World!";

A simple C++ Program #include <iostream> void main (void) { cout << "Hello World!"; }

A simple C++ Program #include <iostream> void main (void) { cout << "Hello World!"; }

A simple C++ Program #include <iostream> void main (void) { cout << "Hello World!"; }

A simple C++ Program #include <iostream> void main (void) { cout << Hello Word ; }

A simple C++ Program #include <iostream> void main (void) { cout << "Hello World!"; }

A First Program - Greeting.cpp Preprocessor directives Function named main() indicates start of program // Program: Display greetings #include <iostream> using namespace std; int main() { cout << "!!!Hello World!!!" << endl; return 0; } Insertion operator Ends executions of main() which ends program Insertion statement Comments Provides simple access Function

Output