Lecture1_2 - Lecture 1 ECE 3090 Software for Engineering...

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

View Full Document Right Arrow Icon
ECE 3090 Software for Engineering Systems Dr. Ayanna Howard School of Electrical and Computer Engineering Georgia Institute of Technology Lecture 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Adapted from “Brief Version of Starting Out with C++” Parts of a C++ Program // sample C++ program #include <iostream> using namespace std; int main() { cout << "Hello, there!"; return 0; } comment preprocessor directive which namespace to use beginning of function named main beginning of block for main output statement string literal send 0 to operating system end of block for main
Background image of page 2
3 Adapted from “Brief Version of Starting Out with C++” Special Characters Beginning of a comment Double slash // End of a programming statement Semicolon ; Encloses string of characters Open/close quotation marks " " Encloses a group of statements Open/close brace { } Used when naming a function Open/close parentheses ( ) Enclose filename in #include Open/close brackets < > Beginning of preprocessor directive Pound sign # Meaning Name Character
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Adapted from “Brief Version of Starting Out with C++” The cout Object Displays output on the computer screen You use the stream insertion operator << to send output to cout : cout << "Programming is fun!";
Background image of page 4
5 Adapted from “Brief Version of Starting Out with C++” The cout Object Produces one line of output: cout << ”Programming " << ”is fun!"; Or: cout << ”Programming "; cout << ”is fun!";
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 Adapted from “Brief Version of Starting Out with C++” The endl Manipulator You can use the endl manipulator to start a new line of output. This will produce two lines of output: cout << "Programming is" << endl; cout << "fun!"; Programming is fun! You do NOT put quotation marks around endl
Background image of page 6
7 Adapted from “Brief Version of Starting Out with C++” The \n Escape Sequence You can also use the \n escape sequence to start a new line of output. This will produce two lines of output: cout << "Programming is\n"; cout << "fun!"; Notice that the \n is INSIDE the string.
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 Adapted from “Brief Version of Starting Out with C++” The #include Directive Inserts the contents of another file into the program This is a preprocessor directive, not part of C++ language #include lines not seen by compiler Do not place a semicolon at end of #include #include <iostream> //part of input-output stream library #include <cmath> // part of complex math library
Background image of page 8
9 Adapted from “Brief Version of Starting Out with C++” Variables and Literals Variable : a storage location in memory Has a name and a type of data it can hold Must be defined before it can be used:
Background image of page 9

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

View Full DocumentRight Arrow Icon
10 Adapted from “Brief Version of Starting Out with C++” Literals Literal : a value that is written into a program’s code. Also called a constant.
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/09/2009 for the course ECE 3090 taught by Professor Staff during the Fall '08 term at Georgia Institute of Technology.

Page1 / 75

Lecture1_2 - Lecture 1 ECE 3090 Software for Engineering...

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

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