ch. 2 - Return # - returns a number at the end of process...

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

View Full Document Right Arrow Icon
Return # - returns a number at the end of process Char- type – character ; - ends the statement Integers – int variable(#); variable Double – real numbers – x(1.234567); Void – type – means there’s nothing, it will return nothing Bool – bl(true); Bf(false); //- Use definitions on the program( comments) to help describe things /* */ faulty line comment Double y; y = ; assigns variable y to something to store in memory Double y(2.0) y = y + n; Double y(2.0) y = y + static_cast<double>(n)(data type cast- static_cast<type>(value) - takes integer n and return double); Double y(2.0) y = y + static_cast<double>(n); m = static_cast<int>(y); - want to take double y and make integer out of it. Want cast the double to an int. It will return an integer. Outputting values to screen: cout Int cout; cout – console output #include<iostream> - input output stream library, required for cout and cin std::cout << “bl =”(from bool above) << bl << “ << “y =” << y << “\n\n”; gives two line breaks Or - using namespace std; - don’t have to go to every line that requires std. cout << “ch = “ << ch << ‘\n\n’; (double quotes with multiple lines, single quotes with single lines.) << “ integer value of ch = “ << static_cast<int>(ch) << ‘\n’; output – ch = 97 cout << “ch = “ << ch << ‘\n\n’; << “ integer value of ch = “ << (int)ch – another way to do cast(int) << ‘\n’; output – ch = 97 Escape sequences - \n Break point at end of program will allow you to see output. Cin – allows us to read values from the keyboard
Background image of page 1

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

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

This note was uploaded on 02/24/2009 for the course ECE 1574 taught by Professor Rpbroadwater during the Spring '08 term at Virginia Tech.

Page1 / 4

ch. 2 - Return # - returns a number at the end of process...

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

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