C++ Programming Basics

Size: px
Start display at page:

Download "C++ Programming Basics"

Transcription

1 C++ Programming Basics Chapter 2 and pp Copyright Delroy A. Brinkerhoff. All Rights Reserved. CS 1410 Chapter 2 Slide 1 of 25

2 Program Components Function main P Every C/C++ program has exactly one function named main < main is not a keyword but should be treated as if it was < main is where the (apparent) program execution begins (it is called by the system) PFunctions have 4 parts < Name < Return value type < Argument list < Body { } int main ( ) body (a block ) return value type name argument list header CS 1410 Chapter 2 Slide 2 of 25

3 Pre-Opened Console Files Pre-opened I/O files available to Console-mode programs PInput < cin >> var; POutput < cout << exp; P Error reporting < cerr << exp; Pcin, cout, and cerr are library objects keyboard standard in stdin cin program screen standard error stderr cerr screen standard out stdout cout CS 1410 Chapter 2 Slide 3 of 25

4 The C/C++ Preprocessor Simple text manipulation P Traditionally, a program (cpp) that ran before the compiler < Functionality may be merged with modern compilers (-E terminates compilation after preprocessing a file) < Performs textual replacement before compilation begins P Processes directives that begin with # < #include <iostream> < and > indicate system header files (located in the include directory) < #include myprog.h " and " indicate program header files located in the current directory < #define line_length 100 nemonic for magic numbers and strings consistency (one place for change) CS 1410 Chapter 2 Slide 4 of 25

5 The Preprocessor In Action Substitutes and copies text #define SIZE 100 other stuff preprocessor iostream stuff compiler prog.h other stuff #include <iostream> #include "prog.h" using namespace std; void main( ) { cout << SIZE; } prog.cpp iostream void main( ) { cout << 100; } temporary file CS 1410 Chapter 2 Slide 5 of 25

6 Compiling Programs Multi-file programs source code compiler object files libraries editor linker executable runtime.cpp.c CS 1410 Chapter 2 Slide 6 of 25.obj.o

7 Basic Data Types Type Specifiers PData types < void 0 bytes no value < char 1 byte -128 to 127 or 0 to 255 < short 2 bytes -32,767 to 32,767 < int 2 to 4 bytes -2,147,483,648 to 2,147,483,647 < long 4 bytes -2,147,483,648 to 2,147,483,647 < bool int false / true < float 4 bytes ± ±38 (6-7 sig digs) < double 8 bytes ± ±308 (~15 sd) < long double 16 bytes not universally supported P Ambiguities < The size of an int is the machine s word size < The only garentee is short # int # long < char is signed on some machines and unsigned on others P Most compilers use IEEE format for floating point numbers CS 1410 Chapter 2 Slide 7 of 25

8 Definitions and Declarations Important vocabulary terms P Definitions allocate memory < Variables: int counter; < Functions: double sqrt(double x) {... } P Declarations introduce a name, identifier, or symbol to the compiler (the name is placed in the compiler s symbol table) < Variables: extern int counter; < Functions: double sqrt(double x); // in <cmath> PA definition may also serve as a declaration CS 1410 Chapter 2 Slide 8 of 25

9 Type Conversions Implicit and Explicit Pchars and ints convert back and forth P Small types automatically promoted to large types in arithmetic expressions PIf a and b are ints, a/b is an int (truncates if necessary) P Explicit conversions are called type casts: (type)expression < Required to convert from a large type to a small type and to force conversions for / < int i = (int) ; // always truncates < int i = (int)( ); < unsigned int i = (unsigned int) 75; < double x = (double) 1 / 3; CS 1410 Chapter 2 Slide 9 of 25

10 Identifier Names (i.e., Symbols) Variables, functions, structures, classes, etc. PRules < May be any length < Are case sensitive < Must begin with a letter, which includes an underscore (_) < Subsequent characters may be letters, digits, and underscores < Cannot be a keyword < May only be defined once in a scope < Should avoid library names < Must be declared before use < Must be defined exactly once CS 1410 Chapter 2 Slide 10 of 25

11 Expression and Statement Overview The Building Blocks - vocabulary terms P C++ is an imparative language PExpressions produce a value < Constant < Variable < Function call (returning a value not void) < Grouping of the above combined with operators < Form r-values (allowed on the RHS =): y + z or sqrt(y) or n > 100 PStatements form a complete unit of work are instructions < Are terminated with a semicolon (;) < May span lines or may be more than one on a line < Function call (not returning a value or value ignored) < Assignment statements: x = y + z; or p = sqrt(y); < Compound (or block) statements are formed of simple statements between { and } (block is not terminated with a semicolon) CS 1410 Chapter 2 Slide 11 of 25

12 Variables Name a region of memory where data is stored PMust be defined before use: includes data type and name P Names are case sensitive PExamples (definition and initialization) < int dollars; < int quarters, dimes, nickels, pennies; < int money = 217; < double x, pi = ; < char begin = 'A', end = 'Z', newline = '\n'; int i; i undefined 0x0a i is unitialized i = 10; i 10 0x0a i is 10 CS 1410 Chapter 2 Slide 12 of 25

13 Variables: Address vs Content Address is intrinsic, content may change PA left value (aka l-value) < is a value that can be on the left hand side of = < is the address of a variable PA right value (aka r-value) < is a value that can be on the right hand side of = < can be any valid expression i = // i represents the address of i (l-value or 0xffffff00) = i // i represents the content of i (r-value or 73) i 73 0xffffff00 CS 1410 Chapter 2 Slide 13 of 25

14 Variable Modifiers C/C++ Keywords P signed P unsigned P long P short Pauto Pstatic little used- turns unsigned char into signed char (the signedness of char is machine and/or implementation defined) no negative values (doubles the magnitude; often used with bit-manipulation operators; unsigned arithmetic does not overflow) long int is usually just called long short int is usually just called short never used except to illustrate that it can be used (i.e., auto is the default access specifier) local static variables maintain values between function invocation CS 1410 Chapter 2 Slide 14 of 25

15 Constants Types and Examples Pchar 'x' // single quote is a char P String "x" // double quote is a string P String "Hello World" Pint < Decimal < unsigned int 123U < long int L < Octal 0377 unsigned only < Hexadecimal 0xff 0xFF unsigned only P float/double e-24 P long double 2.74e145L // uncommon P Explicit float F CS 1410 Chapter 2 Slide 15 of 25

16 Special Character Constants Backslash Characters P Digraphs represent a single character P\n new line P\t horizontal tab P\0 null (terminates strings) P\b back space P\f form feed P\r carriage return P\a alert (i.e., bell) P\" double quote P\' single quote P\\ backslash P\ddd octal number P\xff hexadecimal number P"Hello\tWorld\n" < The compiler automatically places a \0 after the \n CS 1410 Chapter 2 Slide 16 of 25

17 Operators Precedence and Associativity Operator [ ]., -> (dot and arrow) ( ) ++, --! ~ +, - ( ) & * sizeof Description indexing member selectio n function invocation auto increment and decrement logical negation bitwise complement unary grouping and casting address off indirection or dereference size of variable or type *, /, % multiplication, division, modulo º CS 1410 Chapter 2 Slide 17 of 25 Assoc º º º»»»»»»»»

18 Operators Continued +, - addition and subtraction º << >> bitwise left shift bitwise right shift (sign extend) <, >, <=, >= logical relationships º ==,!= logical equality or inequality º & bitwise and º ^ bitwise exclusive-or º bitwise or º && logical and º logical or º?: conditional expression º =, +=, -=, *=, /=, %=, <<=, >>=, &=, =, ^= operation and assignment (target must be a variable or l-value) CS 1410 Chapter 2 Slide 18 of 25 º º»

19 Operator Examples Unusual operators P Multiple assignment (i.e., the = operator returns a value) < i = j = k = 0; /* equivalent to i = (j = (k = 0)) */ < while ((c = getc( ))!= -1) P Auto increment and decrement < Target must be a variable (i.e., an l-value) < int i, j =10; < i = j++; /* i is 10, j is 11 */ < i = ++j; /* i is 11, j is 11 */ < i = j--; /* i is 10, j is 9 */ < i = --j; /* i is 9, j is 9 */ < i++, ++i, i--, and --i are legal (i.e., assignment is not required) < May be embedded in expressions < Often used in array indexes CS 1410 Chapter 2 Slide 19 of 25

20 Auto Increment / Decrement Understanding the shortcuts x = 10; Operator Meaning Result a = x++; a = x; a == 10 x = x + 1; x == 11 a = ++x; x = x + 1; a == 11 a = x; x == 11 a = x--; a = x; a == 10 x = x - 1; x == 9 a = --x; x = x - 1; a == 9 a = x; x == 9 CS 1410 Chapter 2 Slide 20 of 25

21 Operation with Assignment More unusual operators Pop= (+=, -=, *=, /=, %=, ~=, <<=, >>=) < variable op= expression; ø variable = variable op expression; < x += 10; ø x = x + 10; < i -= 2; ø i = i -2; < a /= b; ø a = a / b; < index %= size; ø index = index % size; < mask <<= 2; ø mask = mask << 2; CS 1410 Chapter 2 Slide 21 of 25

22 Comments Program documentation PC < /* comments go here */ < Can span lines PC++ < /* can use C style comments */ < // comments to the end of the line < Styles can be nested < I use C++ style and save C style to temporarily comment out code /* This style works well for large * commentary before functions */ // Function descriptions can // also be presented in this style /* void func( ) { a = b + c: } */ // comment CS 1410 Chapter 2 Slide 22 of 25

23 Test Cases and Program Validation The first step in test driven programming PA test case consists of at least two values: < Input value < Correct output value for the input < Long calculations may require one or more intermediate values PA set of test cases tests the behavior of the program with < Correct input < Incorrect input < Boundary values if appropriate Boundary values are on the boundary between correct and incorrect Many errors occur near or on boundary values double c = 5.0 / 9.0 * (f - 32); test cases: input: 32; output 0 input: 30; output: input: 212; output 100 input: 213; output: CS 1410 Chapter 2 Slide 23 of 25

24 Test Driven Programming AKA Test Driven Development PUnit tests < Are often but not always automated < They test the functionality of individual parts of a system PA unit test is a set of test cases P When practicing test driven programming / development, programmers create the unit test before writing any code PUnder what conditions can the code fail? P Programming is finished when the programmer cannot think of and test for any more failure conditions CS 1410 Chapter 2 Slide 24 of 25

25 Programming Style Only one rule: MAKE IT READABLE P Compiler ignores indentation and blank lines P Long statements may span multiple lines PMultiple statements may be placed on one line P Recomendations: < One definition / declaration per line < One statement per line < Keep lines short enough that they fit on the screen or printed page < Let physical layout reflect logical construction ( pretty printing ) < Use indentation consistently (use a single editor if possible) < Use blank lines to separate code into logical units; more space for more logically separated units < Place braces ( { and } ) consistently CS 1410 Chapter 2 Slide 25 of 25

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

OBJECT ORIENTED PROGRAMMING

OBJECT ORIENTED PROGRAMMING OBJECT ORIENTED PROGRAMMING LAB 1 REVIEW THE STRUCTURE OF A C/C++ PROGRAM. TESTING PROGRAMMING SKILLS. COMPARISON BETWEEN PROCEDURAL PROGRAMMING AND OBJECT ORIENTED PROGRAMMING Course basics The Object

More information

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

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

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

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers

More information

The C++ Language. Arizona State University 1

The C++ Language. Arizona State University 1 The C++ Language CSE100 Principles of Programming with C++ (based off Chapter 2 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University

More information

Chapter 2: Introduction to C++

Chapter 2: Introduction to C++ Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++

More information

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

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley

More information

Work relative to other classes

Work relative to other classes Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 5 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines

More information

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

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program

More information

LECTURE 02 INTRODUCTION TO C++

LECTURE 02 INTRODUCTION TO C++ PowerPoint Slides adapted from *Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* Copyright 2012 Pearson Education Inc. COMPUTER PROGRAMMING LECTURE 02 INTRODUCTION

More information

Overview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O

Overview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O Overview of C Basic Data Types Constants Variables Identifiers Keywords Basic I/O NOTE: There are six classes of tokens: identifiers, keywords, constants, string literals, operators, and other separators.

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

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

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018 C++ Basics Lecture 2 COP 3014 Spring 2018 January 8, 2018 Structure of a C++ Program Sequence of statements, typically grouped into functions. function: a subprogram. a section of a program performing

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

A First Program - Greeting.cpp

A First Program - Greeting.cpp C++ Basics A First Program - Greeting.cpp Preprocessor directives Function named main() indicates start of program // Program: Display greetings #include using namespace std; int main() { cout

More information

Chapter 1 Introduction to Computers and C++ Programming

Chapter 1 Introduction to Computers and C++ Programming Chapter 1 Introduction to Computers and C++ Programming 1 Outline 1.1 Introduction 1.2 What is a Computer? 1.3 Computer Organization 1.7 History of C and C++ 1.14 Basics of a Typical C++ Environment 1.20

More information

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char Week 1 Operators, Data Types & I/O Gaddis: Chapters 1, 2, 3 CS 5301 Fall 2016 Jill Seaman Programming A program is a set of instructions that the computer follows to perform a task It must be translated

More information

Computer Programming : C++

Computer Programming : C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program

More information

2 nd Week Lecture Notes

2 nd Week Lecture Notes 2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous

More information

Lecture 2 Tao Wang 1

Lecture 2 Tao Wang 1 Lecture 2 Tao Wang 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common programming errors

More information

Objectives. In this chapter, you will:

Objectives. In this chapter, you will: Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

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

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program Overview - General Data Types - Categories of Words - The Three S s - Define Before Use - End of Statement - My First Program a description of data, defining a set of valid values and operations List of

More information

Basic Types, Variables, Literals, Constants

Basic Types, Variables, Literals, Constants Basic Types, Variables, Literals, Constants What is in a Word? A byte is the basic addressable unit of memory in RAM Typically it is 8 bits (octet) But some machines had 7, or 9, or... A word is the basic

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering

More information

BITG 1233: Introduction to C++

BITG 1233: Introduction to C++ BITG 1233: Introduction to C++ 1 Learning Outcomes At the end of this lecture, you should be able to: Identify basic structure of C++ program (pg 3) Describe the concepts of : Character set. (pg 11) Token

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

Programming. C++ Basics

Programming. C++ Basics Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++

More information

6.096 Introduction to C++ January (IAP) 2009

6.096 Introduction to C++ January (IAP) 2009 MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture

More information

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered ) FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered )   FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING ( Word to PDF Converter - Unregistered ) http://www.word-to-pdf-converter.net FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING INTRODUCTION TO C UNIT IV Overview of C Constants, Variables and Data Types

More information

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

C++ Basics. Data Processing Course, I. Hrivnacova, IPN Orsay C++ Basics Data Processing Course, I. Hrivnacova, IPN Orsay The First Program Comments Function main() Input and Output Namespaces Variables Fundamental Types Operators Control constructs 1 C++ Programming

More information

Structured Programming Using C++ Lecture 2 : Introduction to the C++ Language. Dr. Amal Khalifa. Lecture Contents:

Structured Programming Using C++ Lecture 2 : Introduction to the C++ Language. Dr. Amal Khalifa. Lecture Contents: Structured Programming Using C++ Lecture 2 : Introduction to the C++ Language Dr. Amal Khalifa Lecture Contents: Introduction to C++ Origins Object-Oriented Programming, Terms Libraries and Namespaces

More information

XC Specification. 1 Lexical Conventions. 1.1 Tokens. The specification given in this document describes version 1.0 of XC.

XC Specification. 1 Lexical Conventions. 1.1 Tokens. The specification given in this document describes version 1.0 of XC. XC Specification IN THIS DOCUMENT Lexical Conventions Syntax Notation Meaning of Identifiers Objects and Lvalues Conversions Expressions Declarations Statements External Declarations Scope and Linkage

More information

Visual C# Instructor s Manual Table of Contents

Visual C# Instructor s Manual Table of Contents Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms

More information

COMP322 - Introduction to C++ Lecture 02 - Basics of C++

COMP322 - Introduction to C++ Lecture 02 - Basics of C++ COMP322 - Introduction to C++ Lecture 02 - Basics of C++ School of Computer Science 16 January 2012 C++ basics - Arithmetic operators Where possible, C++ will automatically convert among the basic types.

More information

Maciej Sobieraj. Lecture 1

Maciej Sobieraj. Lecture 1 Maciej Sobieraj Lecture 1 Outline 1. Introduction to computer programming 2. Advanced flow control and data aggregates Your first program First we need to define our expectations for the program. They

More information

A Fast Review of C Essentials Part I

A Fast Review of C Essentials Part I A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types

More information

! A literal represents a constant value used in a. ! Numbers: 0, 34, , -1.8e12, etc. ! Characters: 'A', 'z', '!', '5', etc.

! A literal represents a constant value used in a. ! Numbers: 0, 34, , -1.8e12, etc. ! Characters: 'A', 'z', '!', '5', etc. Week 1: Introduction to C++ Gaddis: Chapter 2 (excluding 2.1, 2.11, 2.14) CS 1428 Fall 2014 Jill Seaman Literals A literal represents a constant value used in a program statement. Numbers: 0, 34, 3.14159,

More information

CSC 1107: Structured Programming

CSC 1107: Structured Programming CSC 1107: Structured Programming J. Kizito Makerere University e-mail: www: materials: e-learning environment: office: alt. office: jkizito@cis.mak.ac.ug http://serval.ug/~jona http://serval.ug/~jona/materials/csc1107

More information

c++ keywords: ( all lowercase ) Note: cin and cout are NOT keywords.

c++ keywords: ( all lowercase ) Note: cin and cout are NOT keywords. Chapter 1 File Extensions: Source code (cpp), Object code (obj), and Executable code (exe). Preprocessor processes directives and produces modified source Compiler takes modified source and produces object

More information

Chapter 1. C++ Basics. Copyright 2010 Pearson Addison-Wesley. All rights reserved

Chapter 1. C++ Basics. Copyright 2010 Pearson Addison-Wesley. All rights reserved Chapter 1 C++ Basics Copyright 2010 Pearson Addison-Wesley. All rights reserved Learning Objectives In