




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lecture note from a c++ programming fundamentals ii course during summer 2008. It covers the basics of c++ elements, including functions, special symbols, identifiers, simple data types, and basic input/output. The concepts of data types, variables, assignment statements, arithmetic operators, and input/output streams.
Typology: Assignments
1 / 28
This page cannot be seen from the preview
Don't miss anything!





















Summer 2008
June 5, 2008
In this lecture/chapter you should review and: (^) Become familiar with the basic components of a C++ program, including functions, special symbols, and identifiers (^) Explore simple data types and examine the string data type (^) Discover how to use arithmetic operators (^) Examine how a program evaluates arithmetic expressions (^) Learn what an assignment statement is and what
(^) Simple data type (^) Structured data type (^) Pointers
(^) Has two values, true and false (^) Manipulate logical (Boolean) expressions
(^) Range: -3.4E+38 to 3.4E+
(^) Range: -1.7E+308 to 1.7E+
(^) Programmer-defined type supplied in standard library (^) Sequence of zero or more characters (^) Enclosed in double quotation marks (^) Null: a string with no characters (^) Each character has relative position in string (^) Position of first character is 0, the position of the second is 1, and so on (^) Length: number of characters in string
(^) The assignment statement takes the form: variable = expression; (^) Expression is evaluated and its value is assigned to the variable on the left side (^) In C++ = is called the assignment operator (^) A C++ statement such as: i = i + 2; evaluates whatever is in i, adds two to it,
(^) + addition (^) - subtraction (^) * multiplication (^) / division (^) % remainder (mod operator)
In this lecture/chapter you should review and: (^) Discover how to input data into memory using input statements (^) Examine ways to output results using output statements (^) Learn what a stream is and examine input and output streams (^) Explore how to read data from the standard input device (^) Learn how to write data to the standard output device
(^) I/O: sequence of bytes (stream of bytes) from source to destination (^) Bytes are usually characters, unless program requires other types of information (^) Stream: sequence of characters from source to destination (^) Input Stream: sequence of characters from an input device to the computer (^) Output Stream: sequence of characters from the computer to an output device
(^) cin is used with >> to gather input cin>>variable>>variable.. .; (^) The extraction operator is >> (^) For example, if miles is a double variable cin>>miles; (^) Causes computer to get a value of type double (^) Places it in the memory cell miles