CS1123 Computer Programming Spring 2012 Instructor Ghufran Ahmed.

Slides:



Advertisements
Similar presentations
EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Overview of Programming and Problem Solving ROBERT REAVES.
Introduction to Computers and Programming - Class 1 1 Introduction to Computers and Programming Professor Avi Rosenfeld.
Three types of computer languages
Java Environment (CSS444)
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 1 – Introduction to Computers and C++ Programming.
CS 192 Problem Solving and Computer Programming Winter 2003 Instructor Dr. Shafay Shamail TA Adeel Zafar Ibrar Javed.
 2003 Prentice Hall, Inc. All rights reserved. 1 Machine Languages, Assembly Languages, and High-level Languages Three types of computer languages 1.Machine.
Introduction to Computers and Programming Using Java Professor Deena Engel V : Section 1 Office hours: MW 12:00 - 1:00 in room.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers and C++ Programming Outline 1.1Introduction 1.2What Is a Computer?
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
 2000 Prentice Hall, Inc. All rights reserved. 1 Introduction to Computers and C Programming Outline Introduction What Is a Computer? Computer Organization.
C programming language Computer Programming Language 計算機程式設計 Chapter 1 Overview 台大電機系 吳安宇教授 Sept
CS102 Introduction to Computer Programming
 2003 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is a.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
COMPUTER SCIENCE I C++ INTRODUCTION
1 Chapter 1 - Introduction to Computers, the Internet, and the World Wide Web Outline 1.1Introduction 1.2What Is a Computer? 1.3Computer Organization 1.4Evolution.
Lecture 1: Introduction to Computers. OBJECTIVES In this lecture you will learn:  Basic computer concepts.  The different types of programming languages.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Chapter 1 Introduction to Computers, the Internet and the World Wide Web.
Spring 2005, Gülcihan Özdemir Dağ BIL104E: Introduction to Scientific and Engineering Computing, Spring Outline 1.1Introduction 1.2What Is a Computer?
History of C and C++ C++ evolved from C ANSI C C++ “spruces up” C
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Computer Organization Six logical units in every.
 2002 Prentice Hall. All rights reserved. Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is a Computer?
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Introduction to Computers Outline 1.1Introduction.
 2006 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 1 Introduction to Computers, the Internet and.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
1 MIS 131 Introduction to Algorithms and Programming 2015/2016 Fall - Chapter 1 -
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 1 - Introduction to Computers, the Internet, and the World Wide Web Outline 1.1Introduction 1.2What.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Spring 09- ICE0124 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 1.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers, the Internet and the World Wide Web Outline 1.1Introduction 1.2What.
CHAPTER 1.1 INTRODUCTION TO COMPUTERS AND C++ Dr. Shady Yehia Elmashad.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Structured programming 1 st stage By Heba.A Raheem Assist Lecturer College of Sciences/Computer Sciences Department.
Chapter 1 Introduction 2nd Semester H
Introduction to Computers, the Internet and the Web
 2001 Prentice Hall, Inc. All rights reserved.
Chapter 1: Introduction to computers and C++ Programming
Chapter 1 – Introduction to Computers, the Internet, and the Web
Outline Introduction What Is a Computer? Computer Organization
Computer Programming (CS-161)
Chapter 1 – Introduction to Computers and C++ Programming
Chapter 1 – Introduction to Computers and C++ Programming
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Intro to Programming Week # 1 Hardware / Software Lecture # 2
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Programming COMP104: Fundamentals and Methodology Introduction.
Chapter 1 – Introduction to Computers, the Internet, and the Web
Introduction to Computers, the Internet and the Web
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 1 – Introduction to Computers, the Internet, and the Web
Outline Introduction What Is a Computer? Computer Organization
Chapter 1 – Introduction to Computers and C++ Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Introduction to Computer Programming
Introduction to Computer Programming
Chapter 1 – Introduction to Computers and C++ Programming
Introduction to Computers, the Internet and the Web
Introduction to Computers, the Internet and the Web
Introduction to Computers, Internet and the World Wide Web
Chapter 1 – Introduction to Computers and C++ Programming
Presentation transcript:

CS1123 Computer Programming Spring 2012 Instructor Ghufran Ahmed

Schedule Section Lecture Lab I TUE II FRI

Description This first level programming course shall cover the principles and practice of problem solving using C++. Students shall be introduced to the basic C++ techniques such as program control statements, pointers, functions, structures etc. The students shall gain hands-on experience through several programming assignments.

Text Books Primary References Herbert Schildt, ‘C++ from the Ground Up’, 2nd Edition, 1998, Osborne McGraw-Hill. Turbo C Programming by Robert Lafore References Deital & Deital, ‘C++ How to Program’, 3rd Edition, 2001, Prentice Hall. Herbert Schildt, ‘C++: The Complete Reference’, 3rd Edition, 1998, Osborne McGraw-Hill.   Some handouts may be given to supplement the text

Lectures There shall be 30 sessions o 30 sessions of 80 minutes each o labs conducted by lab instructor Grading o 10% Quizzes (quizzes may be based on assignments) o 15% Programming Assignments. o 10% Programming Project. o 5% Class Participation. o 20% Midterm Exam o 40% Final Exam

Topics Introduction Introduction to computer programming and C++ 1 Chapter 1, 2 Overview of C++ and Basic Data Types Programming practices, variables, constants, operators, expressions etc. 1.5 Chapter 2, 3 More Data Types and Operators Enumerations, bool, Bitwise Operators, ? operator, dynamic allocation using new and delete etc. Chapter 9

Topics … Program Control Statements if statement, for loop, switch statement, while loop, do-while loop, continue, break, nested loops 2 Chapter 4 Arrays and Strings One dimensional arrays, strings, string library functions, two dimensional arrays, multidimensional arrays, array initialization, arrays of strings 3 Chapter 5 Pointers Pointer operators, pointer expressions, pointers and arrays, arrays of pointers, problems with pointers Chapter 6

Topics … Functions Scope rules of functions, passing pointers and arrays, argc and argv, return statement, recursion 2 Chapter 7 References, Overloading, and Default Arguments Argument passing, function-overloading etc. Chapter 8 Structures and Unions Chapter 10 Basic File IO Chapter 18

Scholastic Ethics · Students are expected to maintain high standards of academic honesty. The Disciplinary Committee will deal with breaches in scholastic ethics such as cheating. · Plagiarism will be suspected if an assignment that calls for independent development and implementation of a program results in two or more solutions so similar that one solution can be converted to the other(s) by a series of simple commands · Cheating will be suspected if a student who completed an assignment independently cannot explain both the intricacies of the solution and the techniques used to generate that solution

Examples of Cheating Turning in someone else's work, in whole or in part, as your own (with or without his/her knowledge) Turning in a completely duplicated assignment is a flagrant offense Allowing another student to turn in your work as his/her own Several people writing one assignment and turning in multiple copies, all represented (implicitly or explicitly) as individual work

Examples of Not Cheating Turning in work done alone or with the help of the course's TAs. Submitting one assignment for a group of students if group work is explicitly permitted (or required) Getting or giving help about using the computers Getting or giving help about solving minor syntax errors   Penalties for cheating can be an 'F' in the course or worse.

What is a Computer? Computer Computer programs Hardware Software A device capable of performing computations and making logical decisions Computer programs Sets of instructions that control a computer’s processing of data Hardware Various devices comprising a computer Examples: keyboard, screen, mouse, disks, memory, CD-ROM, and processing units Software Programs that run a computer

Computer Organization Six logical units in every computer: Input unit Obtains information from input devices (keyboard, mouse) Output unit Outputs information (to screen, to printer, to control other devices) Memory unit Rapid access, low capacity, stores input information Arithmetic and logic unit (ALU) Performs arithmetic calculations and logic decisions Central processing unit (CPU) Supervises and coordinates the other sections of the computer Secondary storage unit Cheap, long-term, high-capacity storage, stores inactive programs

A Bit of History Which was the first programmable computer? Charles Babbage’s Analytical Engine (early 1800’s) First programmer? Ada Augusta, Countess of Lovelace; Charles’s colleague and daughter of Lord Byron Babbage: English mathematician and physical scientist (1792-1871)

“The Analytical Engine has no pretensions whatever to originate anything. It can do whatever we know how to order it to perform. It can follow analysis; but it has no power of anticipating any analytical relations or truths. Its province is to assist us in making available what we are already acquainted with.” -Ada Augusta, Countess of Lovelace

Evolution of Operating Systems Batch processing Do only one job or task at a time Operating systems Manage transitions between jobs Increased throughput Amount of work computers process Multiprogramming Many jobs or tasks sharing a computer’s resources Timesharing Perform a small portion of one user’s job then move on to service the next user

Personal Computing Distributed Computing Client/Server Computing Personal computers Economical enough for individual Distributed computing Organizations computing is distributed over networks Client/server computing Sharing of information, across computer networks, between file servers and clients (personal computers)

Types of Programming Languages Machine languages Strings of numbers giving machine specific instructions Example: +1300042774 +1400593419 +1200274027 Assembly languages English-like abbreviations representing elementary computer operations (translated via assemblers) LOAD BASEPAY ADD OVERPAY STORE GROSSPAY High-level languages Similar to everyday English, use mathematical notations (translated via compilers) grossPay = basePay + overTimePay

Some High-Level Languages Java used to Create web pages with dynamic and interactive content Develop large-scale enterprise applications Enhance the functionality of web servers Provide applications for consumer devices (such as cell phones, pagers and personal digital assistants) FORTRAN Used in scientific and engineering applications COBOL Used to manipulate large amounts of data Pascal Used to teach structured programming C/C++ Middle-level language Provides facilities for both high level as well as low level programming

History of C and C++ C++ evolved from C ANSI C C evolved from two other programming languages, BCPL and B ANSI C Established worldwide standards for C programming C invented by Dennis Ritchie of AT&T Bell Labs in the 1970s C++ by Bjarne Stroustrup of the same labs in the early 1980s C++ “spruces up” C Provides capabilities for object-oriented programming Objects are reusable software components that model things in the real world Object-oriented programs are easy to understand, correct and modify C is a subset of C++

Structured Programming Disciplined approach to writing programs Clear, easy to test and debug, and easy to modify Multitasking Many activities to run in parallel

Basics of a Typical C++ Environment   Basics of a Typical C++ Environment Phases of C++ Programs: Edit Preprocess Compile Link Load Execute Loader Primary Memory Program is created in the editor and stored on disk. Preprocessor program processes the code. Loader puts program in memory. CPU takes each instruction and executes it, possibly storing new data values as the program executes. Compiler Compiler creates object code and stores it on disk. Linker links the object code with the libraries, creates a.out and stores it on disk Editor Preprocessor Linker   CPU . Disk Files: *.cpp, *.c, *.h *.obj, *.exe

Errors Syntax errors Linker errors Execution/Run-time errors reported by the compiler Linker errors reported by the linker Execution/Run-time errors reported by the operating system Logic errors not reported

Introduction to C++ Programming C++ language Facilitates a structured and disciplined approach to computer program design C and C++ are portable languages Programs written in C and C++ can run on many different computers

Identifiers in C++ A name assigned to: A constant Variable Function User defined data type

Identifiers in C++ … Rules Can be from one to several characters long First 1024 characters are significant May consist of alphanumeric and underscore characters May start with any letter of alphabet, or with an underscore Are case sensitive No special characters are allowed Spaces are not allowed as part of the identifier name Keywords cannot be used as identifiers Any other reserved words by the language (such as names of library functions) shall not be used as identifiers

Identifiers in C++ … Conventions Use identifier names that reflect the meaning or usage of the items being named THISISACONSTANT or THIS_IS_A_CONSTANT thisisavariable or this_is_a_variable thisIsAFunction ThisIsAUserDefinedDataType