Workbook for C++ THIRD EDITION. Yedidyah Langsam, Ph.D. Brooklyn College of the City University of New York. Custom Publishing

Size: px
Start display at page:

Download "Workbook for C++ THIRD EDITION. Yedidyah Langsam, Ph.D. Brooklyn College of the City University of New York. Custom Publishing"

Transcription

1 _CH00_FM_pi-viii.qxd 6/23/09 3:08 AM Page i Workbook for C++ THIRD EDITION Yedidyah Langsam, Ph.D. Brooklyn College of the City University of New York Custom Publishing New York Boston San Francisco London Toronto Sydney Tokyo Singapore Madrid Mexico City Munich Paris Cape Town Hong Kong Montreal

2 _CH00_FM_pi-viii.qxd 1/1/70 10:54 AM Page ii Copyright 2009, 2007, 1997 by Yedidyah Langsam All rights reserved. Permission in writing must be obtained from the publisher before any part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, or by any information storage or retrieval system. All trademarks, service marks, registered trademarks, and registered service marks are the property of their respective owners and are used herein for identification purposes only. Printed in the United States of America MP ISBN10: ISBN13:

3 _CH00_FM_pi-viii.qxd 1/1/70 10:54 AM Page iii CONTENTS To the Student v CHAPTER 1 Introduction to Computers and C++ Programming 1 SECTION 1.1 Computers 1 SECTION 1.2 Programming and Problem Solving 6 SECTION 1.3 C++ Programming Projects 9 CHAPTER 2 C++ Basics 11 SECTION 2.1 Identifiers and Keywords 11 SECTION 2.2 Arithmetic Expressions 12 SECTION 2.3 Arithmetic Precedence 15 SECTION 2.4 Standard (cmath) Library Functions 20 CHAPTER 3 Conditional Branching 25 SECTION 3.1 if and if-else Statements 25 SECTION 3.2 Nested if-else Statements 26 SECTION 3.3 Logical and Relational Operators 28 SECTION 3.4 Integer and Logical Values 33 CHAPTER 4 Flowcharts 37 CHAPTER 5 Loops 45 SECTION 5.1 while Loops 45 SECTION 5.2 for Loops 60 SECTION 5.3 More Complex Loops 64 SECTION 5.4 do-while Loops 66 SECTION 5.5 break and continue Statements 68 SECTION 5.6 switch Statements 71 CHAPTER 6 C++ Input/Output 75 SECTION 6.1 Writing to the Screen (stdout) 75 SECTION 6.2 Read Interactively from the Keyboard (stdin) 79 SECTION 6.3 Reading and writing from Files 80 CHAPTER 7 Integer and Character Variables 81 CHAPTER 8 Functions 87 SECTION 8.1 Functions: Using Value Parameters 87 SECTION 8.2 Functions: Using Reference Parameters 94 SECTION 8.3 Using Arrays in Functions 102 CHAPTER 9 Arrays 109 SECTION 9.1 One-Dimensional Arrays 109 SECTION 9.2 Two-Dimensional Arrays 118 SECTION 9.3 Arrays with Functions 125 CHAPTER 10 Sorting and Searching 127 SECTION 10.1 Sorting 127 SECTION 10.2 Searching 128 CHAPTER 11 String Manipulation in C SECTION 11.1 String Representation 131 SECTION 11.2 The string Library 134 CHAPTER 12 Classes 139 SECTION 12.1 Simple Classes (Without Member Functions) 139 SECTION 12.2 Classes (With Member Functions) 150 SECTION 12.3 Constructors and Destructors 153 CHAPTER 13 Pointers and Indirection 157 CHAPTER 14 Number Systems 161 SECTION 14.1 Decimal 161 SECTION 14.2 Binary and Hexadecimal 161 iii

4 _CH00_FM_pi-viii.qxd 1/1/70 10:54 AM Page iv iv Contents SAMPLE FINAL EXAMINATION ONE 163 SAMPLE FINAL EXAMINATION TWO 169 ANSWERS 175 CHAPTER 1 Introduction to Computers and C++ Programming 175 CHAPTER 2 C++ Basics 178 CHAPTER 3 Conditional Branching 185 CHAPTER 4 Flowcharts 193 CHAPTER 5 Loops 195 CHAPTER 6 C++ Input/Output 203 CHAPTER 7 Integer and Character Variables 208 CHAPTER 8 Functions 211 CHAPTER 9 Arrays 222 CHAPTER 10 Sorting and Searching 234 CHAPTER 11 String Manipulation in C CHAPTER 12 Classes 243 CHAPTER 13 Pointers and Indirection 257 CHAPTER 14 Number Systems 258 Sample Final Examination One 260 Sample Final Examination Two 263 APPENDIX APPENDIX ONE C++ Keywords 269 APPENDIX TWO C++ Operator Precedence and Associativity 271 APPENDIX THREE ASCII Character Set 273 APPENDIX FOUR Selected Library Functions & Methods 275

5 _CH00_FM_pi-viii.qxd 1/1/70 10:54 AM Page v TO THE STUDENT To learn to write computer programs, you must learn to devise algorithms plans of attack to solve the problems that you will be given. After that, you must write the program precisely to carry out your plan. Planning the program is the most important part of the programming process. First, plan your algorithm carefully. Ask yourself what techniques you have learned which pertain to this problem. Ask yourself how you would do this problem without a computer. Break the problem into smaller parts, if possible, and plan the large picture first, leaving the details for later consideration. Working problems in this book will give you practice in using the techniques of the C++ language. That practice will help you when you are planning algorithms, and it will help you write programs more effectively. With sufficient practice, you will know which technique to use to solve a particular problem. Repeated practice with the problems will lessen chances for errors in the programs you submit, and save you time in correction and resubmission. (No one can write error-free programs the first time every time, however.) The problems in this book will also prepare you for similar problems on examinations. ORGANIZATION OF THE BOOK This book is divided into four parts. Part I contains sets of problems on various basic topics that every programming language contains. Part II contains sets of problems on advanced topics. These two parts are the heart of the book. Most problems should take you only a few minutes or less. If you cannot do a problem in 10 to 15 minutes, seek help from a tutor or from your instructor. Some of the problems point out pitfalls to avoid in your programs other problems consist of two or more parts which look alike but which actually contain significant differences. Be on the alert so that you recognize the differences between these types of program segments. Occasionally, exercises are preceded by an asterisk (*) indicating that they contain advanced concepts that may be deferred until later on in the semester. Your instructor may organize his/her lectures in a different order than the chapters in this section and may therefore assign specific exercises for you to do. Part III contains two complete sample Brooklyn College final examinations. Typically, final exams at Brooklyn College are two hours in length and are uniform for all students taking the first course. You will be required to trace programs as well as to write programs of your own. Near the end of the semester, you should test yourself on one of the portions of the final exams given here to see that you can not only do the problems but also that you can do them in the limited time available. The format of your final exam may differ from that which is given here. Ask your instructor whether additional sample final examinations are available. Part IV contains tables of C++ Keywords, Precedence of Operators, the ASCII Character set and some library functions. Answers to the problems in Parts I to III are given at the end of the text. Do not look at the answers until you have seriously attempted the problems yourself. Otherwise, it is very easy to trick v

6 _CH00_FM_pi-viii.qxd 1/1/70 10:54 AM Page vi vi To The Student yourself into believing that you understand a concept when you see the answer; it may be a different matter when you have to generate the answer yourself. There is more than one way to do many computer assignments. If a method is presented in the solution which is different from your method, it is not necessarily true that your method is wrong. Compare the methods to see if you can tell why the printed answer is better, or worse, than yours. Are the methods equivalent? Will they both work with all kinds of data? If your answer is incorrect, try to learn from your mistake. You may learn a new algorithm from the answer given if you did not do the problem in the same way. TYPES OF ERRORS There are many types of errors in computer programming. Syntax errors, or compilation errors, which include the use of incorrect punctuation, incorrect keywords, etc., will be identified by the compiler during compilation. The C++ compiler will try to guess what error occurred but its guess is not necessarily correct. You can be sure that an error has been made at the point specified or immediately before that point. Knowing where the error is makes it easier to correct it and submit the program again. Never submit a program for grading which has errors in it. A second type of error is an execution or run-time error. These errors involve asking the computer to do something which it cannot do. For example, if you ask the computer to divide by a variable which has a current value of zero, an execution error will result. The C++ compiler will show you where the error occurred, which is a big help in trying to correct it. Logical errors are usually more difficult to find and more difficult to correct. These errors usually arise when the programmer does not understand the nature of the problem which is to be solved, or inadvertently gives the computer incorrect instructions to follow. For example, omitting the minus sign in a statement such as x = y; will be undetected by the computer. Unless some following use of the value produced (such as taking the square root of the answer) allows distinction between the value wanted and that produced, the computer has no way of telling that the minus sign has been omitted. However, an incorrect answer will be produced. You should check by hand at least several of the answers produced by the computer to see that your code is written correctly. Some errors will not occur with some data, but will show up with other data. For example, if you want to take the square root of x, the correct answer may appear whenever x is positive but an error will occur when x is negative. Try to test your programs with a wide variety of values to ensure that they will work with all kinds of data. An error frequently encountered is an infinite loop. Infinite loops are often generated by logical errors which have made the computer repeat a set of instructions again and again. You might see nothing at all happening at your computer. (The same symptom is produced when the computer is waiting for you to enter some data.) You might put some cout statements into your program temporarily so that some action is taken by the computer while it is in the loop, allowing you to diagnose what is happening. In fact, such temporary cout statements are an effective way to debug a program no matter what types of errors are involved. ACKNOWLEDGMENTS First and foremost, I would like to thank Professor David E. Goldberg and Professor Keith Harrow my co-authors on previous versions of this book, PL/I and PL/C Workbook and Workbook for Pascal for permission to use many of the exercises in those books. In addition, Professor Harrow spent many additional hours proofreading early drafts of this book and offered many helpful suggestions. A special thank you to Professor Eva Cogan for finding many of the errors in the text. Of course any errors that remain are the responsibility of the author. I am grateful to Professors David

7 _CH00_FM_pi-viii.qxd 1/1/70 10:54 AM Page vii To The Student vii Arnow, Keith Harrow, Jacqueline A. Jones and Gerald Weiss for their many suggestions regarding C++ programming style. All the programs in this text have been tested and debugged. Programs given in this book have been developed using the Dev-C beta 9.2 ( ) with Mingw/GCC 3.9/3.4.2 which is freely available at Readers are encouraged to download this compiler in order to develop their own programs. Another highly recommended freely available C++ IDE can be found at The author wishes to thank Mr. Raheel Zamir for his invaluable assistance in this task. Mr. Zamir has also contributed many of the exercises that have been introduced in this edition of the text. To my wife, Vivienne, and my children, I offer special thanks for their forbearance during the summer, which was lost to them by my full time commitment to this book.

8 _CH00_FM_pi-viii.qxd 1/1/70 10:54 AM Page viii

Prelude to Programming

Prelude to Programming GLOBAL EDITION Prelude to Programming Concepts and Design SIXTH EDITION Stewart Venit Elizabeth Drake Prelude toprogramming Sixth Edition Global Edition Concepts and Design Stewart Venit Elizabeth Drake

More information

MariaDB Crash Course. A Addison-Wesley. Ben Forta. Upper Saddle River, NJ Boston. Indianapolis. Singapore Mexico City. Cape Town Sydney.

MariaDB Crash Course. A Addison-Wesley. Ben Forta. Upper Saddle River, NJ Boston. Indianapolis. Singapore Mexico City. Cape Town Sydney. MariaDB Crash Course Ben Forta A Addison-Wesley Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid Cape Town Sydney Tokyo Singapore Mexico City

More information

Programming in Python 3

Programming in Python 3 Programming in Python 3 A Complete Introduction to the Python Language Mark Summerfield.4.Addison-Wesley Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich

More information

CLASSIC DATA STRUCTURES IN JAVA

CLASSIC DATA STRUCTURES IN JAVA CLASSIC DATA STRUCTURES IN JAVA Timothy Budd Oregon State University Boston San Francisco New York London Toronto Sydney Tokyo Singapore Madrid Mexico City Munich Paris Cape Town Hong Kong Montreal CONTENTS

More information

Database Concepts. David M. Kroenke UNIVERSITATSBIBLIOTHEK HANNOVER

Database Concepts. David M. Kroenke UNIVERSITATSBIBLIOTHEK HANNOVER Database Concepts Fifth Edition David M. Kroenke David J. Auer ^111 I ii i.111 111 n.n jiiim^ TECHNISCHE INFORMATIOMSBiBLIOTHEK UNIVERSITATSBIBLIOTHEK HANNOVER j TIB/UB Hannover Prentice Hall Boston Columbus

More information

THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS. Using Assembly and С

THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS. Using Assembly and С THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS Using Assembly and С Muhammad AH Mazidi Sarmad Naimi Sepehr Naimi Prentice Hall Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam

More information

This page intentionally left blank

This page intentionally left blank Database Concepts This page intentionally left blank Database Concepts Seventh Edition David M. Kroenke David J. Auer Western Washington University Boston Columbus Indianapolis New York San Francisco Hoboken

More information

DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA

DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA WALLS AND MIRRORS First Edition Frank M. Carrano University of Rhode Island Janet J. Prichard Bryant College Boston San Francisco New York London Toronto

More information

ony Gaddis Haywood Community College STARTING OUT WITH PEARSON Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto

ony Gaddis Haywood Community College STARTING OUT WITH PEARSON Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto STARTING OUT WITH J^"* 1 Ti * ony Gaddis Haywood Community College PEARSON Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris

More information

HCS12 Microcontroller and Embedded Systems: Using Assembly and C with CodeWarrior 1 st Edition

HCS12 Microcontroller and Embedded Systems: Using Assembly and C with CodeWarrior 1 st Edition Online Instructor s Manual to accompany HCS12 Microcontroller and Embedded Systems: Using Assembly and C with CodeWarrior 1 st Edition Muhammad Ali Mazidi Danny Causey Prentice Hall Boston Columbus Indianapolis

More information

An Introduction to Programming with IDL

An Introduction to Programming with IDL An Introduction to Programming with IDL Interactive Data Language Kenneth P. Bowman Department of Atmospheric Sciences Texas A&M University AMSTERDAM BOSTON HEIDELBERG LONDON NEW YORK OXFORD PARIS SAN

More information

LATEX. Leslie Lamport. Digital Equipment Corporation. Illustrations by Duane Bibby. v ADDISON-WESLEY

LATEX. Leslie Lamport. Digital Equipment Corporation. Illustrations by Duane Bibby. v ADDISON-WESLEY LATEX A Document Preparation System User's Guide and Reference Manual Leslie Lamport Digital Equipment Corporation Illustrations by Duane Bibby v ADDISON-WESLEY Boston San Francisco New York Toronto Montreal

More information

Objects First with Java

Objects First with Java ^ Objects First with Java A Practical Introduction using BlueJ David J. Barnes and Michael Kolling Second edition PEARSON Prentice Hall Harlow, England London New York Boston San Francisco Toronto Sydney

More information

C for Electronic Engineering

C for Electronic Engineering C for Electronic Engineering with applied software engineering William Buchanan Prentice Hall London New York Toronto Sydney Tokyo Singapore Madrid Mexico City Munich CONTENTS PREFACE 1 INTRODUCTION 1.1

More information

PROBLEM SOLVING USING JAVA WITH DATA STRUCTURES. A Multimedia Approach. Mark Guzdial and Barbara Ericson PEARSON. College of Computing

PROBLEM SOLVING USING JAVA WITH DATA STRUCTURES. A Multimedia Approach. Mark Guzdial and Barbara Ericson PEARSON. College of Computing PROBLEM SOLVING WITH DATA STRUCTURES USING JAVA A Multimedia Approach Mark Guzdial and Barbara Ericson College of Computing Georgia Institute of Technology PEARSON Boston Columbus Indianapolis New York

More information

World Wide Web PROGRAMMING THE PEARSON EIGHTH EDITION. University of Colorado at Colorado Springs

World Wide Web PROGRAMMING THE PEARSON EIGHTH EDITION. University of Colorado at Colorado Springs PROGRAMMING THE World Wide Web EIGHTH EDITION ROBERT W. SEBESTA University of Colorado at Colorado Springs PEARSON Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape

More information

Visual C# Tony Gaddis. Haywood Community College STARTING OUT WITH. Piyali Sengupta. Third Edition. Global Edition contributions by.

Visual C# Tony Gaddis. Haywood Community College STARTING OUT WITH. Piyali Sengupta. Third Edition. Global Edition contributions by. STARTING OUT WITH Visual C# 2012 Third Edition Global Edition Tony Gaddis Haywood Community College Global Edition contributions by Piyali Sengupta PEARSON Boston Columbus Indianapolis New York San Francisco

More information

Chapter 2 Basic Elements of C++

Chapter 2 Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion

More information

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and

More information

Programming. In Ada JOHN BARNES TT ADDISON-WESLEY

Programming. In Ada JOHN BARNES TT ADDISON-WESLEY Programming In Ada 2005 JOHN BARNES... TT ADDISON-WESLEY An imprint of Pearson Education Harlow, England London New York Boston San Francisco Toronto Sydney Tokyo Singapore Hong Kong Seoul Taipei New Delhi

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

Introduction to Programming using C++

Introduction to Programming using C++ Introduction to Programming using C++ Lecture One: Getting Started Carl Gwilliam gwilliam@hep.ph.liv.ac.uk http://hep.ph.liv.ac.uk/~gwilliam/cppcourse Course Prerequisites What you should already know

More information

Programming Fundamentals - A Modular Structured Approach using C++ By: Kenneth Leroy Busbee

Programming Fundamentals - A Modular Structured Approach using C++ By: Kenneth Leroy Busbee 1 0 1 0 Foundation Topics 1 0 Chapter 1 - Introduction to Programming 1 1 Systems Development Life Cycle N/A N/A N/A N/A N/A N/A 1-8 12-13 1 2 Bloodshed Dev-C++ 5 Compiler/IDE N/A N/A N/A N/A N/A N/A N/A

More information

Computer Programming C++ (wg) CCOs

Computer Programming C++ (wg) CCOs Computer Programming C++ (wg) CCOs I. The student will analyze the different systems, and languages of the computer. (SM 1.4, 3.1, 3.4, 3.6) II. The student will write, compile, link and run a simple C++

More information

DB2 SQL Tuning Tips for z/os Developers

DB2 SQL Tuning Tips for z/os Developers DB2 SQL Tuning Tips for z/os Developers Tony Andrews IBM Press, Pearson pic Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid Cape Town Sydney

More information

SAULT COLLEGE OF APPLIED ARTS AND TECHNOLOGY SAULT STE. MARIE, ONTARIO. Sault College COURSE OUTLINE CODE NO. : CSD100 SEMESTER: 1

SAULT COLLEGE OF APPLIED ARTS AND TECHNOLOGY SAULT STE. MARIE, ONTARIO. Sault College COURSE OUTLINE CODE NO. : CSD100 SEMESTER: 1 SAULT COLLEGE OF APPLIED ARTS AND TECHNOLOGY SAULT STE. MARIE, ONTARIO Sault College COURSE OUTLINE COURSE TITLE: CODE NO. : SEMESTER: 1 PROGRAM: AUTHOR: ALL COMPUTER STUDIES PROGRAMS Dennis Ochoski DATE:

More information

EMBEDDED SYSTEMS: Jonathan W. Valvano INTRODUCTION TO THE MSP432 MICROCONTROLLER. Volume 1 First Edition June 2015

EMBEDDED SYSTEMS: Jonathan W. Valvano INTRODUCTION TO THE MSP432 MICROCONTROLLER. Volume 1 First Edition June 2015 EMBEDDED SYSTEMS: INTRODUCTION TO THE MSP432 MICROCONTROLLER Volume 1 First Edition June 2015 Jonathan W. Valvano ii Jonathan Valvano First edition 3 rd printing June 2015 The true engineering experience

More information

Curriculum Map Grade(s): Subject: AP Computer Science

Curriculum Map Grade(s): Subject: AP Computer Science Curriculum Map Grade(s): 11-12 Subject: AP Computer Science (Semester 1 - Weeks 1-18) Unit / Weeks Content Skills Assessments Standards Lesson 1 - Background Chapter 1 of Textbook (Weeks 1-3) - 1.1 History

More information

SQL Queries. for. Mere Mortals. Third Edition. A Hands-On Guide to Data Manipulation in SQL. John L. Viescas Michael J. Hernandez

SQL Queries. for. Mere Mortals. Third Edition. A Hands-On Guide to Data Manipulation in SQL. John L. Viescas Michael J. Hernandez SQL Queries for Mere Mortals Third Edition A Hands-On Guide to Data Manipulation in SQL John L. Viescas Michael J. Hernandez r A TT TAddison-Wesley Upper Saddle River, NJ Boston Indianapolis San Francisco

More information

PROGRAMMING AND CUSTOMIZING

PROGRAMMING AND CUSTOMIZING PROGRAMMING AND CUSTOMIZING THE PICAXE MICROCONTROLLER SECOND EDITION DAVID LINCOLN Mc Grauu Hill New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore

More information

How & Why We Subnet Lab Workbook

How & Why We Subnet Lab Workbook i How & Why We Subnet Lab Workbook ii CertificationKits.com How & Why We Subnet Workbook Copyright 2013 CertificationKits LLC All rights reserved. No part of this book maybe be reproduced or transmitted

More information

HUDSON VALLEY COMMUNITY COLLEGE TROY, NEW YORK COURSE OUTLINE

HUDSON VALLEY COMMUNITY COLLEGE TROY, NEW YORK COURSE OUTLINE ACADEMIC YEAR 2017-2018 HUDSON VALLEY COMMUNITY COLLEGE TROY, NEW YORK COURSE OUTLINE COURSE TITLE: Assembly Language And Computer Architecture COURSE SUBJECT AND NUMBER: CISS 280 DEPARTMENT: Computing

More information

CoSci 440 SYLLABUS Programming in C++ INSTRUCTOR Mari Rettke cell SECTION : and 13345

CoSci 440 SYLLABUS Programming in C++ INSTRUCTOR Mari Rettke cell SECTION : and 13345 CoSci 440 SYLLABUS Programming in C++ INSTRUCTOR Mari Rettke samusher@aol.com 818.470.8419 - cell SECTION : 13327 and 13345 Course Description Covers C++ language and object-oriented programming paradigm.

More information

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++ Introduction to Programming in C++ Course Text Programming in C++, Zyante, Fall 2013 edition. Course book provided along with the course. Course Description This course introduces programming in C++ and

More information

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are: LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words

More information

Constructing Algorithms and Pseudocoding This document was originally developed by Professor John P. Russo

Constructing Algorithms and Pseudocoding This document was originally developed by Professor John P. Russo Constructing Algorithms and Pseudocoding This document was originally developed by Professor John P. Russo Purpose: # Describe the method for constructing algorithms. # Describe an informal language for

More information

Updated: 2/14/2017 Page 1 of 6

Updated: 2/14/2017 Page 1 of 6 MASTER SYLLABUS 2017-2018 A. Academic Division: Business, Industry, and Technology B. Discipline: Engineering Technology C. Course Number and Title: ENGR1910 Engineering Programming D. Course Coordinator:

More information

An Object Oriented Programming with C

An Object Oriented Programming with C An Object Oriented Programming with C By Tanmay Kasbe Dr. Ravi Singh Pippal IDEA PUBLISHING WWW.ideapublishing.in i Publishing-in-support-of, IDEA PUBLISHING Block- 9b, Transit Flats, Hudco Place Extension

More information

STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode

STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode STUDENT OUTLINE Lesson 8: Structured Programming, Control Structures, if- Statements, Pseudocode INTRODUCTION: This lesson is the first of four covering the standard control structures of a high-level

More information

[CHAPTER] 1 INTRODUCTION 1

[CHAPTER] 1 INTRODUCTION 1 FM_TOC C7817 47493 1/28/11 9:29 AM Page iii Table of Contents [CHAPTER] 1 INTRODUCTION 1 1.1 Two Fundamental Ideas of Computer Science: Algorithms and Information Processing...2 1.1.1 Algorithms...2 1.1.2

More information

Creating a procedural computer program using COBOL Level 2 Notes for City & Guilds 7540 Unit 005

Creating a procedural computer program using COBOL Level 2 Notes for City & Guilds 7540 Unit 005 Creating a procedural computer program using COBOL Level 2 Notes for City & Guilds 7540 Unit 005 Compatible with Micro Focus Net Express 5.0 COBOL compiler Version 1 Tench Computing Ltd Pines Glendale

More information

PYTHON. p ykos vtawynivis. Second eciitiovl. CO Ve, WESLEY J. CHUN

PYTHON. p ykos vtawynivis. Second eciitiovl. CO Ve, WESLEY J. CHUN CO Ve, PYTHON p ykos vtawynivis Second eciitiovl WESLEY J. CHUN. PRENTICE HALL Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid Capetown Sydney

More information

Practical C++ Programming

Practical C++ Programming SECOND EDITION Practical C++ Programming Steve Oualline O'REILLY' Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo Preface xv Part I. The Basics 1. What Is C++? 3 A Brief History of C++ 3 C++

More information

The print queue was too long. The print queue is always too long shortly before assignments are due. Print your documentation

The print queue was too long. The print queue is always too long shortly before assignments are due. Print your documentation Chapter 1 CS488/688 F17 Assignment Format I take off marks for anything... A CS488 TA Assignments are due at the beginning of lecture on the due date specified. More precisely, all the files in your assignment

More information

Data Structures and Abstractions with Java

Data Structures and Abstractions with Java Global edition Data Structures and Abstractions with Java Fourth edition Frank M. Carrano Timothy M. Henry Data Structures and Abstractions with Java TM Fourth Edition Global Edition Frank M. Carrano University

More information

Real-Time Systems and Programming Languages

Real-Time Systems and Programming Languages Real-Time Systems and Programming Languages Ada, Real-Time Java and C/Real-Time POSIX Fourth Edition Alan Burns and Andy Wellings University of York * ADDISON-WESLEY An imprint of Pearson Education Harlow,

More information

A Document Preparation System. User's Guide and Reference Manual. Leslie Lamport

A Document Preparation System. User's Guide and Reference Manual. Leslie Lamport A Document Preparation System User's Guide and Reference Manual Leslie Lamport Digital Equipment Corporation Illustrations by Duane Bibby TT ADDISON-WESLEY Boston San Francisco New York Toronto Montreal

More information

EECE.2160: ECE Application Programming Spring 2019

EECE.2160: ECE Application Programming Spring 2019 Course Meetings Section 201: MWF 8-8:50, Kitson 305 Section 202: MWF 12-12:50, Kitson 305 Course Website Main page: http://mjgeiger.github.io/eece2160/sp19/ Schedule: http://mjgeiger.github.io/eece2160/sp19/schedule.htm

More information

Data Structures and Abstractions with Java

Data Structures and Abstractions with Java Global edition Data Structures and Abstractions with Java Fourth edition Frank M. Carrano Timothy M. Henry Data Structures and Abstractions with Java TM Fourth Edition Global Edition Frank M. Carrano University

More information

Using MATLAB, SIMULINK and Control System Toolbox

Using MATLAB, SIMULINK and Control System Toolbox Using MATLAB, SIMULINK and Control System Toolbox A practical approach Alberto Cavallo Roberto Setola Francesco Vasca Prentice Hall London New York Toronto Sydney Tokyo Singapore Madrid Mexico City Munich

More information

Understanding and Writing Compilers

Understanding and Writing Compilers Understanding and Writing Compilers Macmillan Computer Science Series Consulting Editor Professor F. H. Sumner, University of Manchester G. M. Birtwistle, Discrete Event Modelling on Simula Richard Bornat,

More information

To become familiar with array manipulation, searching, and sorting.

To become familiar with array manipulation, searching, and sorting. ELECTRICAL AND COMPUTER ENGINEERING 06-88-211: COMPUTER AIDED ANALYSIS LABORATORY EXPERIMENT #2: INTRODUCTION TO ARRAYS SID: OBJECTIVE: SECTIONS: Total Mark (out of 20): To become familiar with array manipulation,

More information

PESIT-BSC Department of Science & Humanities

PESIT-BSC Department of Science & Humanities LESSON PLAN 15PCD13/23 PROGRAMMING IN C AND DATA Course objectives: STRUCTURES The objective of this course is to make students to learn basic principles of Problem solving, implementing through C programming

More information

Bits, Words, and Integers

Bits, Words, and Integers Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are

More information

Interfacing with C++

Interfacing with C++ Interfacing with C++ Jayantha Katupitiya Kim Bentley Interfacing with C++ Programming Real-World Applications ABC Dr. Jayantha Katupitiya Senior Lecturer School of Mechanical and Manufacturing Engineering

More information

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10

Mathematics/Science Department Kirkwood Community College. Course Syllabus. Computer Science CSC142 1/10 Mathematics/Science Department Kirkwood Community College Course Syllabus Computer Science CSC142 Bob Driggs Dean Cate Sheller Instructor 1/10 Computer Science (CSC142) Course Description Introduces computer

More information

The Unified Modeling Language User Guide

The Unified Modeling Language User Guide The Unified Modeling Language User Guide Grady Booch James Rumbaugh Ivar Jacobson Rational Software Corporation TT ADDISON-WESLEY Boston San Francisco New York Toronto Montreal London Munich Paris Madrid

More information

Overview : Table Of Content :

Overview : Table Of Content : Book Title:-A Workbook on C++ Author :-Sumit Mittu ISBN :-9788131520666 Price :-INR 499 Pages :-396 Edition :-2 Imprint :-Cengage Learning India Year :-2013 'A Workbook on C++ covers the topics required

More information

Course materials Reges, Stuart, and Stepp, Martin. Building Java Programs: A Back to Basics Approach. 2d ed. (Boston: Addison-Wesley, 2011).

Course materials Reges, Stuart, and Stepp, Martin. Building Java Programs: A Back to Basics Approach. 2d ed. (Boston: Addison-Wesley, 2011). AP Computer Science A Advanced Placement Computer Science A is a fast-paced course equivalent to a college introductory programming class. Students will learn about the exciting kinds of problems tackled

More information

Lecture 1 Getting Started with SAS

Lecture 1 Getting Started with SAS SAS for Data Management, Analysis, and Reporting Lecture 1 Getting Started with SAS Portions reproduced with permission of SAS Institute Inc., Cary, NC, USA Goals of the course To provide skills required

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #44. Multidimensional Array and pointers

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #44. Multidimensional Array and pointers Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #44 Multidimensional Array and pointers In this video, we will look at the relation between Multi-dimensional

More information

Bash Programming. Student Workbook

Bash Programming. Student Workbook Student Workbook Bash Programming Published by ITCourseware, LLC, 7245 South Havana Street, Suite 100, Englewood, CO 80112 Contributing Authors: Julie Johnson, Rob Roselius Editor: Jeff Howell Special

More information

C++ Programming for Non-C Programmers. Supplement

C++ Programming for Non-C Programmers. Supplement C++ Programming for Non-C Programmers Supplement ii C++ Programming for Non-C Programmers C++ Programming for Non-C Programmers Published by itcourseware, 10333 E. Dry Creek Rd., Suite 150, Englewood,

More information

Chapter 2.6: Testing and running a solution

Chapter 2.6: Testing and running a solution Chapter 2.6: Testing and running a solution 2.6 (a) Types of Programming Errors When programs are being written it is not surprising that mistakes are made, after all they are very complicated. There are

More information

CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis

CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis Handout written by Julie Zelenski with edits by Keith Schwarz. The Goal In the first programming project, you will get

More information

Welcome to Starting Out with Programming Logic and Design, Third Edition.

Welcome to Starting Out with Programming Logic and Design, Third Edition. Welcome to Starting Out with Programming Logic and Design, Third Edition. This book uses a language-independent approach to teach programming concepts and problem-solving skills, without assuming any previous

More information

Problem Solving with C++

Problem Solving with C++ GLOBAL EDITION Problem Solving with C++ NINTH EDITION Walter Savitch Kendrick Mock Ninth Edition PROBLEM SOLVING with C++ Problem Solving with C++, Global Edition Cover Title Copyright Contents Chapter

More information

Lecture 5. Review from last week. Selection Statements. cin and cout directives escape sequences

Lecture 5. Review from last week. Selection Statements. cin and cout directives escape sequences Lecture 5 Selection Statements Review from last week cin and cout directives escape sequences member functions formatting flags manipulators cout.width(20); cout.setf(ios::fixed); setwidth(20); 1 What

More information

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.

More information

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Slide 3-3 Flow Of Control Flow of control refers to the

More information

Assembly Language Assembled for the Sinclair ZX81

Assembly Language Assembled for the Sinclair ZX81 Assembly Language Assembled for the Sinclair ZX81 Macmillan Computing Books Assembly Language Programming for the BBC Microcomputer Ian Birnbaum Advanced Programming for the 16K ZX81 Mike Costello Microprocessors

More information

Access ComprehGnsiwG. Shelley Gaskin, Carolyn McLellan, and. Nancy Graviett. with Microsoft

Access ComprehGnsiwG. Shelley Gaskin, Carolyn McLellan, and. Nancy Graviett. with Microsoft with Microsoft Access 2010 ComprehGnsiwG Shelley Gaskin, Carolyn McLellan, and Nancy Graviett Prentice Hall Boston Columbus Indianapolis New York San Francisco Upper Saddle River Imsterdam Cape Town Dubai

More information

This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units.

This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units. This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units. Introduction Overview Advancements in technology are

More information

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

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja

More information

College Board. AP CS A Labs Magpie, Elevens, and Picture Lab. New York: College Entrance Examination Board, 2013.

College Board. AP CS A Labs Magpie, Elevens, and Picture Lab. New York: College Entrance Examination Board, 2013. AP Computer Science August 2014 June 2015 Class Description AP Computer Science is the second class after Pre-AP Computer Science that together teach the fundamentals of object-oriented programming and

More information

3. Simple Types, Variables, and Constants

3. Simple Types, Variables, and Constants 3. Simple Types, Variables, and Constants This section of the lectures will look at simple containers in which you can storing single values in the programming language C++. You might find it interesting

More information

بسم اهلل الرمحن الرحيم

بسم اهلل الرمحن الرحيم بسم اهلل الرمحن الرحيم Fundamentals of Programming C Session # 10 By: Saeed Haratian Fall 2015 Outlines Examples Using the for Statement switch Multiple-Selection Statement do while Repetition Statement

More information

CS 241 Data Organization using C

CS 241 Data Organization using C CS 241 Data Organization using C Fall 2018 Instructor Name: Dr. Marie Vasek Contact: Private message me on the course Piazza page. Office: Farris 2120 Office Hours: Tuesday 2-4pm and Thursday 9:30-11am

More information

Xcode 6 Start to Finish

Xcode 6 Start to Finish Xcode 6 Start to Finish ios and OS X Development Fritz Anderson VAddison-Wesley New York Boston Indianapolis San Francisco Toronto Montreal Capetown Sydney London Munich Paris Madrid Tokyo Singapore Mexico

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

MASTERING COBOL PROGRAMMING

MASTERING COBOL PROGRAMMING MASTERING COBOL PROGRAMMING MACMILLAN MASTER SERIES Banking Basic English Law Basic Management Biology British Politics Business Communication Business Microcomputing Chemistry COBOL Programming Commerce

More information

C++ Programming for Non-C Programmers. Supplement

C++ Programming for Non-C Programmers. Supplement C++ Programming for Non-C Programmers Supplement C++ Programming for Non-C Programmers C++ Programming for Non-C Programmers Published by ITCourseware, 7245 S. Havana St, Suite 100, Centennial, CO 80112

More information

Topic 1: Programming concepts

Topic 1: Programming concepts Topic 1: Programming concepts Learning Outcomes Upon successful completion of this topic you will be able to: identify stages of a program development implement algorithm design techniques break down a

More information

MECHATRONICS. William Bolton. Sixth Edition ELECTRONIC CONTROL SYSTEMS ENGINEERING IN MECHANICAL AND ELECTRICAL PEARSON

MECHATRONICS. William Bolton. Sixth Edition ELECTRONIC CONTROL SYSTEMS ENGINEERING IN MECHANICAL AND ELECTRICAL PEARSON MECHATRONICS ELECTRONIC CONTROL SYSTEMS IN MECHANICAL AND ELECTRICAL ENGINEERING Sixth Edition William Bolton PEARSON Harlow, England London New York Boston San Francisco Toronto Sydney Auckland Singapore

More information

JAVASCRIPT FOR PROGRAMMERS

JAVASCRIPT FOR PROGRAMMERS JAVASCRIPT FOR PROGRAMMERS DEITEL DEVELOPER SERIES Paul J. Deitel Deitel & Associates, Inc. Harvey M. Deitel Deitel & Associates, Inc. PRENTICE HALL Upper Saddle River, NJ Boston Indianapolis San Francisco

More information

CIS 130 Exam #2 Review Suggestions

CIS 130 Exam #2 Review Suggestions CIS 130 - Exam #2 Review Suggestions p. 1 * last modified: 11-11-05, 12:32 am CIS 130 Exam #2 Review Suggestions * remember: YOU ARE RESPONSIBLE for course reading, lectures/labs, and especially anything

More information

PROBLEM SOLVING WITH FORTRAN 90

PROBLEM SOLVING WITH FORTRAN 90 David R. Brooks PROBLEM SOLVING WITH FORTRAN 90 FOR SCIENTISTS AND ENGINEERS Springer Contents Preface v 1.1 Overview for Instructors v 1.1.1 The Case for Fortran 90 vi 1.1.2 Structure of the Text vii

More information

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 1 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) WHO

More information

Modesto Junior College Course Outline of Record CMPSC 241

Modesto Junior College Course Outline of Record CMPSC 241 Modesto Junior College Course Outline of Record CMPSC 241 I. OVERVIEW The following information will appear in the 2010-2011 catalog CMPSC 241 Assembly Language Programming Prerequisite: Satisfactory completion

More information

QUIZ How do we implement run-time constants and. compile-time constants inside classes?

QUIZ How do we implement run-time constants and. compile-time constants inside classes? QUIZ How do we implement run-time constants and compile-time constants inside classes? Compile-time constants in classes The static keyword inside a class means there s only one instance, regardless of

More information

Introduction to Programming System Design CSCI 455x (4 Units)

Introduction to Programming System Design CSCI 455x (4 Units) Introduction to Programming System Design CSCI 455x (4 Units) Description This course covers programming in Java and C++. Topics include review of basic programming concepts such as control structures,

More information

ENGINEERING PROGRAMMING

ENGINEERING PROGRAMMING ENGINEERING PROGRAMMING MS in Earth Science Engineering Semester 1, 2018/19 COURSE COMMUNICATION FOLDER University of Miskolc Faculty of Earth Science and Engineering Institute of Geophysics and Geoinformatics

More information

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

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this

More information

3D Graphics Programming Mira Costa High School - Class Syllabus,

3D Graphics Programming Mira Costa High School - Class Syllabus, 3D Graphics Programming Mira Costa High School - Class Syllabus, 2009-2010 INSTRUCTOR: Mr. M. Williams COURSE GOALS and OBJECTIVES: 1 Learn the fundamentals of the Java language including data types and

More information

DATA AND COMPUTER COMMUNICATIONS

DATA AND COMPUTER COMMUNICATIONS DATA AND COMPUTER COMMUNICATIONS Ninth Edition William Stallings Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal

More information

Integrated Approach. Operating Systems COMPUTER SYSTEMS. LEAHY, Jr. Georgia Institute of Technology. Umakishore RAMACHANDRAN. William D.

Integrated Approach. Operating Systems COMPUTER SYSTEMS. LEAHY, Jr. Georgia Institute of Technology. Umakishore RAMACHANDRAN. William D. COMPUTER SYSTEMS An and Integrated Approach f Architecture Operating Systems Umakishore RAMACHANDRAN Georgia Institute of Technology William D. LEAHY, Jr. Georgia Institute of Technology PEARSON Boston

More information

Object-Oriented Programming and Data Structures

Object-Oriented Programming and Data Structures Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin Phillips Academy, Andover, Massachusetts Gary Litvin Skylight Software, Inc. Skylight Publishing Andover, Massachusetts

More information

Fundamentals of. Database Systems. Shamkant B. Navathe. College of Computing Georgia Institute of Technology PEARSON.

Fundamentals of. Database Systems. Shamkant B. Navathe. College of Computing Georgia Institute of Technology PEARSON. Fundamentals of Database Systems 5th Edition Ramez Elmasri Department of Computer Science and Engineering The University of Texas at Arlington Shamkant B. Navathe College of Computing Georgia Institute

More information

CSE100 Principles of Programming with C++

CSE100 Principles of Programming with C++ 1 Instructions You may work in pairs (that is, as a group of two) with a partner on this lab project if you wish or you may work alone. If you work with a partner, only submit one lab project with both

More information

Designing Loops and General Debug Pre-Defined Functions in C++ CS 16: Solving Problems with Computers I Lecture #6

Designing Loops and General Debug Pre-Defined Functions in C++ CS 16: Solving Problems with Computers I Lecture #6 Designing Loops and General Debug Pre-Defined Functions in C++ CS 16: Solving Problems with Computers I Lecture #6 Ziad Matni Dept. of Computer Science, UCSB Announcements Homework #5 due today Lab #3

More information