how_to_think_like_a_computer_scientist_cpp_version

how_to_think_like_a_computer_scientist_cpp_version - How to...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: How to think like a computer scientist Allen B. Downey C++ Version, First Edition 2 How to think like a computer scientist C++ Version, First Edition Copyright (C) 1999 Allen B. Downey This book is an Open Source Textbook (OST). Permission is granted to reproduce, store or transmit the text of this book by any means, electrical, mechanical, or biological, in accordance with the terms of the GNU General Public License as published by the Free Software Foundation (version 2). This book is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL- ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The original form of this book is LaTeX source code. Compiling this LaTeX source has the effect of generating a device-independent representation of a textbook, which can be converted to other formats and printed. All intermediate representations (including DVI and Postscript), and all printed copies of the textbook are also covered by the GNU General Public License. The LaTeX source for this book, and more information about the Open Source Textbook project, is available from http://www.cs.colby.edu/~downey/ost or by writing to Allen B. Downey, 5850 Mayflower Hill, Waterville, ME 04901. The GNU General Public License is available from www.gnu.org or by writ- ing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. This book was typeset by the author using LaTeX and dvips, which are both free, open-source programs. Cover Art, “The Magician,” by Scott H. Reed Copyright (C) 1999 Scott H. Reed All rights reserved. No part of the cover art may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electrical, me- chanical or biological, without prior written permission of the copyright holder: Scott H. Reed, 5639 Mayflower Hill, Waterville, ME 04901. Contents 1 The way of the program 1 1.1 What is a programming language? . . . . . . . . . . . . . . . . . 1 1.2 What is a program? . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 What is debugging? . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.3.1 Compile-time errors . . . . . . . . . . . . . . . . . . . . . 4 1.3.2 Run-time errors . . . . . . . . . . . . . . . . . . . . . . . . 4 1.3.3 Logic errors and semantics . . . . . . . . . . . . . . . . . 4 1.3.4 Experimental debugging . . . . . . . . . . . . . . . . . . . 5 1.4 Formal and natural languages . . . . . . . . . . . . . . . . . . . . 5 1.5 The first program . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.6 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 Variables and types 11 2.1 More output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2 Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.4 Assignment...
View Full Document

This document was uploaded on 08/10/2011.

Page1 / 189

how_to_think_like_a_computer_scientist_cpp_version - How to...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online