class 3 - << “b2 =” << b2 << ‘\n’...

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

View Full Document Right Arrow Icon
char ch1 = ‘a’,          ch2 (‘b’); cout << “ch1 = “ << ch1 << ‘/n’          <<”ch2 =” << ch2 << “/n/n”; int n1 = 1,      n2(2); cout <<  “n1 = “ << n1 << ‘/n’          << “n2 = “ << n2 << “ /n/n”; double d1(0.0),               d2(1.0),               d3(1.23456789); cout << “d1 = “ << d1 << ‘/n’ << “d2 = “ << d2 << ‘\n’ << “d3 = “ << d3 << “\n\n”; bool b1(true), (be = 1)          b2(false), (be = 0)          b3(0), (false since zero = 0 in output)          b4(100), (true since non zero = 1 in output)          b5(1.2); ( = 1 in output) cout << “b1 = “ << b1 << ‘\n’
Background image of page 1

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

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

Unformatted text preview: << “b2 =” << b2 << ‘\n’ << “b3 =” << b3 << ‘\n’ << “b4 = “ << b4 << ‘\n’ << “b5 = “ << b5 << “\n\n”; assignment operator – data type casts: static_cast<type>(value) n1 = ch1; cout << “n1 = “ << static_cast<char>(n1) << ‘\n’ (static_cast will cast n1 to char from int) << “n1 = “ << char(n1) << “\n\n” ; outputs n1 to a instead of 1. n1 = 98; ch1 = n1; cout << “ ch1 =” << ch1<< “\n\n”; outputs little b since n1 is 98, 97 = a. n2 = d3; cout << “n2 =” << n2 << “\n\n”; console input: cin...
View Full 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 / 2

class 3 - << “b2 =” << b2 << ‘\n’...

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