You are on page 1of 173

 

Are there alternate exam times?
 Yes, the information is on the syllabus

Which XCODE version?
 Xcode 5 if your OS supports
 if not, version your OS supports

 

Which Visual Studio Version?
 We suggest Visual Studio Professional 2013

How to register my i>clicker?
 Register through ctools

 

Posting your code on Piazza is NOT allowed.

To get help:
 Piazza  183help@umich.edu (when you reply, do Reply All)

 Go to discussion sections
 Go to office hours

  Zyante && CodeLab .Due Fri 1/17 Zyante:  Required Readings are on syllabus  Infinite number of attempts possible  CodeLab  "sort by deadline" – upper-left-hand side  Infinite number of submits possible .

ML Dorf .

Executing the procedure happens here Thinking Memory Information and Procedure to answer the question are stored here Question Answer .

Processor Question Answ er Memory (stores data and procedure “program”) .

I/O Devices Hardware Processor Computer Memory Data Software Code .

Data Program Results (computer) .

 A program is:  An implementation of an algorithm  An algorithm is:  A sequence of instructions used to accomplish a goal. .

 Check whether a number is even or odd x Read X If X is divisible by 2: Write “Even” Else: Write “Odd” Odd Divisible By 2 Even .

 A Programming Language is:  an artificial language designed to communicate instructions to a computer  Convenient for people to write programs  Convenient for computers to “understand” Why not use “Natural Languages” ?  (like English)  .

 A programming Language Has Two Components:  Syntax (Form) ▪ ▪ ▪ ▪ Keywords (Vocabulary) Operators Expressions (Sentences) Etc.  Semantics (Meaning) ▪ ▪ ▪ ▪ Examples: if = condition while = conditioned loop Etc.  No ambiguity .

cin>>x.A program is an implementation of an algorithm #include <iostream> using namespace std. } return 0. } Read X If X is divisible by 2: Write “Even” Else: Write “Odd” Algorithm C++ Implementation . if (x % 2 == 0) { cout << "Even". int main() { int x. }else{ cout << "Odd".

A program is an implementation of an algorithm Read X If X is divisible by 2: Write “Even” Else: Write “Odd” x = int(raw_input('Enter a value: ')) if x % 2 == 0: print 'Even' else print 'Odd' Algorithm Python Implementation .

 There are many different classes of programming languages  Check: http://en.wikipedia.org/wiki/List_of_programming_languages_by_t ype#Procedural_languages .

We are interested in:
High Level
VS

Machine

Compiled

VS

Interpreted

Machine

Easier for Humans

Faster for Computers

High-level

High-Level
int x = 3; int y = 5; boolean flag; if(x+y > 7){ flag = true; }

Object Code Machine (Binary)

010101110100101010111 100101010101111010111 000111100111111110001 010101110100111110100 111111100001001111011

• Easy to read, write, & debug • Employ powerful data and control primitives • e.g. C++, Java, PHP, etc

• • • • •

Difficult to read, write Direct control Executes fast Hard to use Not portable

write Direct control Executes fast Hard to use Not portable . etc • • • • • Difficult to read. if(x+y > 7){ flag = true. C++.High-Level int x = 3. Java.g. } Object Code Machine (Binary) Compiler 010101110100101010111 100101010101111010111 000111100111111110001 010101110100111110100 111111100001001111011 • Easy to read. int y = 5. boolean flag. & debug • Employ powerful data and control primitives • e. PHP. write.

Compiled Interpreted .

  Recently turned 30: Has aged well Makes it possible to create programs with  Fast execution  Small amount of code  Runs on a variety of computing environments (portable)  Functionality  Features .

 C++ 11  Standardized in 2011  Enables creation of complex/powerful apps  Business  Open source  Most games  Fast execution .

0 – released Oct 16.5  Makes it possible to create programs with  Fast development  Small amount of code  Runs on a variety of computing environments (portable)  Functionality && Features  Great for web development .  Almost 20 (1st release Jan 1994) Python 2.7. 2000  Most current: Python 2.

7.5 3.   Python 2.not backwards compatible Enables creation of complex/powerful apps  Web-based software  Open source  Best asset  Software development more rapid  Execution speed  Has improved – still slow comparatively .3 -.

Memory was something you lost with age • An application was for employment • A program was a TV show • A keyboard was a piano • A web was a spider's home • A virus was the flu • A CD was a bank account • A hard drive was a long trip on the road • A mouse pad was where a mouse lived • .

  First Program C++ Language Elements •Standard Libraries •Identifiers •Comments •Variables & Literals •Operators •Data Types •Expressions •Mixed Mode •Casting .

} End .Start int main (void) { return 0. and go back to caller (usually the OS) ..

} "main" function .where it all starts int main (void) { return 0.

} values passed to the program (nothing in this case) .int main (void) { return 0.

} Go back to where the function was called from (OS in case of 'main') .int main (void) { return 0.

int main (void) { return 0; } Return Value
(When 0 is returned to the OS from main, it means “all is good”)

Return Type
int main (void) { return 0; }

Return Type
int main (void) { these MUST match in types return 0; } Return Value

} Denotes the end of a simple statement .int main (void) { return 0.

} Denote the beginning and the end of code blocks. In this case.int main (void) { return 0. . they define where the function starts and ends.

} . return 0. int main (void) { cout << "Hello World!" << endl.#include <iostream> using namespace std.

} A Statement.#include <iostream> using namespace std. int main (void) { cout << "Hello World!" << endl. Prints "Hello World!" to the standard output stream . return 0.

return 0. int main (void) { cout << "Hello World!" << endl.#include <iostream> using namespace std. } object to send output to Basically. says to print to standard output stream .

return 0. int main (void) { cout << "Hello World!" << endl.#include <iostream> using namespace std. } operator for printing used to put things into output stream .

#include <iostream> using namespace std. Denotes end of line int main (void) { cout << "Hello World!" << endl. return 0. } .

this is a STATEMENT int main (void) { cout << "Hello World!" << endl.#include <iostream> C++ using namespace std. } . return 0.

.#include <iostream> using namespace std. } I/O operations require including the I/O standard file from the C++ standard library. return 0. int main (void) { cout << "Hello World!" << endl.

return 0.#include <iostream> using namespace std. } A directive that tells the preprocessor to include code of iostream library before compilation . int main (void) { cout << "Hello World!" << endl.

#include <iostream> using namespace std. int main (void) { cout << "Hello World!" << endl. . return 0. } All files in the C++ standard library declare all of its entities within the std namespace.

import sys def main (argv): print 'Hello World!' int main (void) { cout << "Hello World!" << endl.argv) } . if __name__=='__main__': return 0.#include <iostream> using namespace std. main(sys.

#include <iostream> using namespace std. main(sys.argv) } . import sys def main (argv): print 'Hello World!' int main (void) { cout << "Hello World!" << endl. if __name__=='__main__': return 0.

argv) } . if __name__=='__main__': return 0.#include <iostream> using namespace std. main(sys. import sys def main (argv): print 'Hello World!' int main (void) { cout << "Hello World!" << endl.

A) void B) int C) real D) I have no idea .

A) Make reading the code easier B) Meant to confuse students C) Group statements together D) Show where ‘main’ begins and ends .

. compile it and test it Then write some more code. compile it and test it  Etc.   Always keep your code in a working state Write some code.

You don’t want to write a lot of code and then discover that something is wrong! Why??? . compile it and test it Then write some more code. compile it and test it Etc.      Always keep your code in a working state Write some code.

  First Program C++ Language Elements •Standard Libraries •Identifiers •Comments •Variables & Literals •Operators •Data Types •Expressions •Mixed Mode •Casting .

 Install of C++ provides  base set of built-in capabilities  Many additional features provided standard libraries  The standard I/O library iostream defines features for input and output  needs to be specifically included to be used  #include <iostream>  using namespace std. .

import . Install of C++ provides  base set of built-in capabilities  Many additional features provided standard libraries  The standard I/O library iostream defines features for input and output  needs to be specifically included to be used  #include <iostream> Python:  using namespace std.

  First Program C++ Language Elements •Standard Libraries •Identifiers •Comments •Variables & Literals •Operators •Data Types •Expressions •Mixed Mode •Casting .

.. Comments are parts of the source code disregarded by the compiler C++ // line comment /* . block comment … */ .

// My first Program // Author: ML Dorf // Date: 01. int main ( void) { cout << "Hello World!" << endl. } .2014 #include <iostream> using namespace std.14. return 0.

block comment … */ Python # line comment Python """ block comment """ .. Comments are parts of the source code disregarded by the compiler C++ // line comment /* ..

14.2014 import sys def main (argv): print 'Hello World!' if __name__ == '__main__': main(sys.# My first Program # Author: ML Dorf # Date: 01.argv) .

  First Program C++ Language Elements •Standard Libraries •Identifiers •Comments •Variables & Literals •Operators •Data Types •Expressions •Mixed Mode •Casting .

//1 2 are integer literals cout << "Hello World!". Values  Also knows as “literals”   cout << 1 + 2. //string literal .

 Common "operators" or symbols to do calculations are: Add 2 numbers Subtract 2 numbers Multiply 2 numbers Divide one number by another Remainder with INTEGER division (MOD) + * / % .

  ^ does NOT indicate exponentiation ^ is Bitwise exclusive OR .

(negative) and ONE number  Examples:  -5 +3  Binary Operators: +. *. ** and a number on both sides – operator’s in the middle  Examples:  3+2 -5 * 7 10 % 6 . . %. Unary Operators: + (positive). -. /.

  First Program C++ Language Elements •Standard Libraries •Identifiers •Comments •Variables & Literals •Operators •Data Types •Expressions •Mixed Mode •Casting .

Operands can be literals. or other expressions  Examples:  ▪ 5 + (3 / 2) * 10 ▪ -5 + 3 . variables. Expressions are sequences of operators and operands.

return 0.#include <iostream> using namespace std. } A) 49 B) 31 C) none of the above . int main(void) { cout << 3 + 4 * 7 << endl.

return 0. int main(void) { cout << "3 + 4 * 7" << endl. } A) 49 B) 31 C) none of the above .#include <iostream> using namespace std.

com/w/cpp/language/operator_precedence • Grouping defines the precedence order when several operators of the same precedence level are in an expression.Precedence 1 2 3 4 5 Operator () + . .(binary) = Grouping Left to right Right to left Left to right Left to right Right to left • See a full list http://en.(unary) * / % + .cppreference.

(unary) 3 4 5 * / % + .Precedence Operator 1 () 2 + .(binary) = Grouping Left to right Right to left Left to right Left to right Right to left cout << 3 + 4 * 7 << endl. cout << 3 + 28 << endl. .

A) B) C) D) E) 6 11 17 60 None of the above .3 + 2 * 6.What does the following statement print? cout << 10 / 5 .

What does the following statement print? cout << 15 / 5 % 2 * 3. A) B) C) D) E) 45 3 6 9 None of the above .

A) B) C) D) E) 45 3 6 9 None of the above .What does the following statement print? cout << 15 / (5 % 2) * 3.

What does the following statement print? cout << "24 / 4 * 2". A) B) C) D) 12 3 1 None of the above .

0 / 3.0  2/3  5.0 / 2.0  5/2 A) 0 B) 0.Watch out if you have int / int  2.666… C) Don’t Know .

666… C) Don’t Know .0  5/2 A) 0 B) 0.Watch out if you have int / int  2.0  2/3  5.0 / 3.0 / 2.

0  2/3  5.0 / 3.0  5/2 A) 2 B) 2.Watch out if you have int / int  2.5 C) 3 D) Don’t Know .0 / 2.

0 / 2.5 C) 3 D) Don’t Know .0  5/2 A) 2 B) 2.0 / 3.0  2/3  5.Watch out if you have int / int  2.

Watch out if you have int / int  2.0  5/2  -5 / 2 A) -2 B) -2.0 / 3.0 / 2.5 C) -3 D) Don’t Know .0  2/3  5.

5 % 2 2 % 3 A) 0 B) 1 C) 2 D) 3 E) Don’t Know .

5 % 2 2 % 3 A) 0 B) 1 C) 2 D) 3 E) Don’t Know .

5 % 2 2 % 3 4 % 2 A) 0 B) 1 C) 2 D) 3 E) Don’t Know .

How many hours and minutes are there in 375 minutes? A) hours: 375 / 60 minutes: 375 % 60 B) hours: 375 % 60 minutes: 375 / 60 C) hours: 375 / 60 minutes: (375 / 60.0 .375 / 60) * 60 D) Don’t Know .

 Given pCode an int variable that holds postal codes  MI has 5-digit postal codes that start with 48 or 49 48109 for BBB Building on Hayward  To get the 1st 2 digits of pCode: A) B) C) D) pCode pCode pCode pCode % / % / 10000 10000 1000 1000  Send to MI if 1st 2 digits is equal to (48 or 49) .

25 * 3 % 4 A) 1 B) 97 C) none of the above .  What does the following evaluate to? 100 .

  What does the following evaluate to? 3+2+1-5+4%2-1/4+6 A) 6 B) 7 C) none of the above .

  First Program C++ Language Elements •Standard Libraries •Identifiers •Comments •Variables & Literals •Operators •Data Types •Expressions •Mixed Mode •Casting .

   A variable is a name for something Sets up a location in memory Stores a value into that location .

playerScore numZombiesDefeated .   Give it a name that describes its purpose Specify the type of info it will hold Examples: Memory  int playerScore.  int numZombiesDefeated.

 Variables great way to reuse values and store results  Variables must have a name .

    char int double bool  float  hold over from years ago  computers had limited memory .

 Examples: 'A' '$' '5' 'e'  Range  -128 to 127 (signed)  0 to 255 (unsigned) .

.g. Each character represented by a unique value  encoding is done via ASCII look-up table  e. 'A' stored as 65 (01000001) .

Dec 0 1 2 3 4 Char NULL Start of Heading Start of Text End of Text End of Transmission Dec 12 13 14 15 16 Char Form Feed (\f) Carriage Return (\r) Shift Out Shift In Data Link Escape Dec Char 24 25 26 27 28 Cancel End of Medium Substitute Escape File Separator 5 6 7 8 9 Enquiry Acknowledge Bell (\a) Backspace (\b) Horizontal Tab (\t) 17 18 19 20 21 Device Cntrl 1 Device Cntrl 2 Device Cntrl 3 Device Cntrl 4 Negative Acknowledge 29 30 31 Group Separator Record Separator Unit Separator 10 11 Line Feed (\n) Vertical Tab (\v) 22 23 Synchronous Idle End of Trans. Block .

/ 0 1 2 60 61 62 63 64 Char Dec < = > ? @ 74 75 76 77 78 Char Dec J K L M N 88 89 90 91 92 Char Dec X Y Z [ \ 102 103 104 105 106 Char Dec f g h i j 116 117 118 119 120 Char t u v w x 46 47 48 49 50 ! " # $ 37 38 39 40 41 42 43 44 45 % & ' ( ) * + . - 51 52 53 54 55 56 57 58 59 3 4 5 6 7 8 9 : . 65 66 67 68 69 70 71 72 73 A B C D E F G H I 79 80 81 82 83 84 85 86 87 O P Q R S T U V W 93 94 95 96 97 98 99 100 101 ] ^ _ ` a b c d e 107 108 109 110 111 112 113 114 115 k l m n o p q r s 121 122 123 124 125 126 y z { | } ~ .Dec 32 33 34 35 36 Char Dec space Char Dec .

/ 0 1 2 60 61 62 63 64 Char Dec < = > ? @ 74 75 76 77 78 Char Dec J K L M N 88 89 90 91 92 Char Dec X Y Z [ \ 102 103 104 105 106 Char Dec f g h i j 116 117 118 119 120 Char t u v w x 46 47 48 49 50 ! " # $ 37 38 39 40 41 42 43 44 45 % & ' ( ) * + . - 51 52 53 54 55 56 57 58 59 3 4 5 6 7 8 9 : . 65 66 67 68 69 70 71 72 73 A B C D E F G H I 79 80 81 82 83 84 85 86 87 O P Q R S T U V W 93 94 95 96 97 98 99 100 101 ] ^ _ ` a b c d e 107 108 109 110 111 112 113 114 115 k l m n o p q r s 121 122 123 124 125 126 y z { | } ~ .Dec 32 33 34 35 36 Char Dec space Char Dec .

 Examples: 5. -1. 323. 1000  Range:  Signed: -2147483468 to 2147483467 (32-bit)  Unsigned: 0 to 4294967295 .

 Do NOT begin integers with a zero  Do NOT do: 01234 Will get weird results .

Whole numbers


No commas (1,000 won’t work!)
No spaces (1 000 000 won’t work!)

Range:
 -2147483468 to 2147483467 (32-bit)

That's  -2,147,483,468 to 2,147,483,467 (32-bit)

How about: remember 10 digits and 1st digit is a 2 (or just "2 billion+") .

.

.

.

.

  Known as: OverFlow could be 0  goes out positive and comes in negative go ????  Be Careful .

22507e-308 to 1.79769e+308   "default" datatype for Real numbers "floating point" numbers .double   Size: 8 bytes Range: 2.

0 3.141592 -42. Examples: 1.32e2 3.0E4 5E-3 1.15  Numbers with decimal values .

0.06 represented as
 6e-2  6E-2  6.0e-2  .6e-1

float: Not used any more (except on old machines)
  

Size: 4 bytes Range:  1.17549e-38 to 3.40282e+38 original form for Real Numbers

booleans only have two values
 True  False

boolean values normally are the result of comparing two values more on these later

308 double 8bytes floating point number (~15 digits) . It can bool take one of two 1byte true or false values: true or false Double precision +/.7e +/.Name char Description Character or small integer Size* int Integer Range* signed: -128 to 127 1byte unsigned: 0 to 255 signed: -2147483648 to 2147483647 4bytes unsigned: 0 to 4294967295 (10 digits) Boolean value.1.

Which of the following is not a valid datatype? A) double B) float C) Int D) char .

Which of the following is not a valid datatype? A) int B) real C) bool D) char .

 variables must have a type   variables must have a name variable type can’t be changed once declared .

    variables must have a type variables must have a name variable type can’t be changed once declared Examples:  int value. c.  double pi. .  char oneChar.  int a. b.

1) Start with a letter or underscore ('_') 2) After the first character. underscores. or digits 3) Can’t be reserved word (also known as reserved words)    Max size 31 chars (most systems) C++ is case-sensitive (int != Int) System identifiers usually start with '_' . any number of letters.

g. can’t be used as function names) • List 5 keywords that we have seen so far: .• Words reserved by C++ language • Have special meanings • Can’t be used as identifiers (e.

alignas alignof and and_eq asm auto(1) bitand bitor bool break case catch char char16_t char32_t class compl const constexpr const_cast continue decltype default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new noexcept not not_eq nullptr operator or or_eq private protected public register reinterpret_cast return short signed sizeof static static_assert static_cast struct switch template this thread_local throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while xor xor_eq .

alignas alignof and and_eq asm auto(1) bitand bitor bool break case catch char char16_t char32_t class compl const constexpr const_cast continue decltype default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new noexcept not not_eq nullptr operator or or_eq private protected public register reinterpret_cast return short signed sizeof static static_assert static_cast struct switch template this thread_local throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while xor xor_eq .

int main (void) { cout << "Hello World!" << endl.14.// My first Program // Author: My Name // Date: 01.2013 #include <iostream> using namespace std. return 0. } .

and as assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try while with yield .

and as assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try while with yield .

# My first Program # Author: ML Dorf # Date: 01.14.2014 import sys def main (argv): print 'Hello World!' if __name__ == '__main__': main(sys.argv) .

 Sets up a storage location int value. 4 bytes (int size) value .

 Sets up a storage location int value. double pi. 4 bytes (int size) value 8 bytes (double size) pi .

 Sets up a storage location int value. double pi. value  We will use this notation for simplicity pi .

e.. prints whatever arbitrary value happens to be in x . ? value   Prints garbage i.int x. cout << x << endl.

Used to store a value in a variable  Main assignment operator: =  variable = value Assignment (not equality) .

x = y. Example int x. . x = 5. y. y = 3.

 Example Execution int x. ? x ? y . y = 3. x = 5. x = y. y.

y = 3. x = 5. x = y. 5 x Execution ? y . Example int x. y.

y. Example int x. x = y. y = 3. 5 x Execution 3 y . x = 5.

 Example int x. x = y. y = 3. x = 5. y. 3 x Execution 3 y .

 The right hand side (RHS) of an assignment can be an expression The lest hand side (LHS) MUST be a variable  variable = expression the Then the result is stored in the variable Value of the expression is computed first .

 Example x = 5 + 10 15 .

int x. y. z. x = y = z = 5. x = 5.  Multiple assignments work too Example: int x. Equivalent . z = 5. y. z. y = 5.

int b = 3. int d (-10). . b = c = 3. c. c = 3. d = -10. Equivalent int a. int d.Declare a variable and assign a value to in one statement  Examples:  int a = 5. int b. a = 5.

x. y. return 0. cout << y << endl. y = x * x. y = y / value. value = 4. } A) 2 B) 4 C) 6 D) none of the above . x = 3.#include <iostream> using namespace std. int main( void ) { int value.

 Mixed Data Types in expression:  each sub-expression is promoted to the "highest" type prior to evaluation  Type Promotion Guidelines  bool= char  int  double .

. x = 11 / 5.0 / 5.double x. x = 11.

2 int is promoted to double and then the division is performed . x = 11 / 5. //x will have value 2.0 / 5.double x.0 //x will have value 2. x = 11.

value = 12.What will be stored? double value. .

What will be stored? Execution double value. value = 12. ? double variable int value .

Execution 12.0 value = 12. int value double variable Implicit type conversion from int to double (upcasting) .What will be stored? double value.

value = 3.What will be stored? int value.67. .

? int variable double value .What will be stored? Execution int value. value = 3.67.

67.What will be stored? int value. Execution 3 value = 3. double value int variable Implicit type conversion from double to int (downcasting) .

OK. but you’ll lose some  called "spillage"  Compiler tries to help prevent this   issues warning  pay attention to all "warnings" . you can.You can’t put a large value into a small cup Well.

} A) B) C) D) 0 4 6 none of the above . int a = x. cout << a << endl.4.#include <iostream> using namespace std. return 0. int main( void ) { double x = 6.

 Implicit Conversion  Happens automatically  Explicit Conversion  Using the casting operator: (type) “old form”  Using keyword: static_cast<type> “new form” .

 Examples 2.0 y x 5 int x = (int) 5. // new form . // old form double y = static_cast<double> 2.23.

int i = 1. double x = i / j. // x  0.0 . j = 3.

j = 3.int i = 1. double x = i / j.0 . // x  0.

//x  0.int i = 1.0 . j = 3. // x  0.0 x = (double)i / (double)j. double x = i / j.

//x0.int i = 1.33 // x  0. //x  0. double x = i / j.0 x = (double)i / (double)j. j = 3.0 .

33 .0 x = (double)i / (double)j. //x0. j = 3.int i = 1. //x0.33 x = (double)i / j. //x0. double x = i / j. //x  0.33 x = i / (double)j.

//x0. //x0.33 x = i / (double)j. j = 3. //x0. .33 x = (double)i / j.0 x = (double)i / (double)j.int i = 1. double x = i / j.33 x = (double)(i / j). //x  0.

33 x = i / (double)j. //x0. double x = i / j.33 x = (double)i / j. //x0.33 x = (double)(i / j). //x0. //x  0.0 .0 x = (double)i / (double)j. //x  0. j = 3.int i = 1.

x = 1000 * 1000 * 1000 * 1000 * 0.5. A)0.5 E12 B)0 C)non-deterministic .double x. cout << x << endl.

  Variables do not need to be declared Take on type of value assigned into it x = 5 #x is an int y = 3.5 #y is a float x=y # x is now a float .

67) x = float(4) .What will be stored? value = int(3.

char ch = 'A'. x = x % y. y(7. j = 0.double x(5. j = 42. .5). x = i / j. int i = 10. ch = $ i = 5.2).

int i = 10.5). // run-time error . x = x % y. j = 0. x = i / j. // syntax error // syntax error i = 5. j = 42. y(7. char ch = 'A'.2).double x(5. ch = $.

7.double x = 3. i = (int) (x). i = (int) (x + 0. (rounds x) // i  3 // i  4 .5).

(rounds x) // i  3 // i  4 . i = (int) (x + 0.7.double x = 3. i = (int) (x).5).

// i  3 // i  4 . i = (int) (x).7.5). i = (int) (x + 0.double x = 3.

i = (int) (x). i = (int) (x + 0.5). // i  3 // i  4 a great way to round x .double x = 3.7.

int v = b. circle the statements that would be legal if these lines were in a single main program int x = 34.5. y = y + 10. int y = g. int n = 12. v = n. int p = 3 * g + y. . double y = 9. int b = 3. bool boo = x. double k = 1000 * 1000 * 1000 * 90 * . int s.5.5. s = y. int g = 17. From the following list.

You're never going to change!!! 14. Just gotta have one 10.Across 3. Could be called "Father" Down 1. Can't pin it down 4. Announce a new variable 11. Acronym for a chip 7. Source code consumer 6. Department of LAN jockeys 13. Quite a crew of characters 2. Number variable type 12. Not an integer (or ____ your boat) 3. Say something . Nothing is there 5. What's a prompt good for? 8. Acronym for your laptop's power 9. RUN 13.

  main function and structure of a program iostream  +. char. float. double  Coming up next: input and output 202 . -. /. %. int. *. =. ()  operators and precedence  datatypes and their relative sizes  bool.