Example2_18 - #include <iostream> # #include...

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

View Full Document Right Arrow Icon
#include <iostream> #include <string> # using namespace std; u int main() { int firstNum, secondNum; double z; char ch; string name; cout << "When prompted, enter the following data and " << "press the enter key: " << endl; cout << "8 16.3 Jenny D" << endl; firstNum = 4; //Statement 1 cout << "firstNum = " << firstNum << endl; secondNum = 2 * firstNum + 6; //Statement 2 cout << "firstNum = " << firstNum << ", secondNum = " << secondNum << endl; z = (firstNum + 1) / 2.0; //Statement 3 cout << "firstNum = " << firstNum << ", secondNum = " << secondNum << ", z = " << z << endl; ch = 'A'; //Statement 4 cout << "firstNum = " << firstNum << ", secondNum = " << secondNum << ", z = " << z << ", ch = " << ch << endl; cin >> secondNum; //Statement 5 cout << "firstNum = " << firstNum << ", secondNum = " << secondNum << ", z = " << z << ", ch = " << ch << endl; cin >> z; //Statement 6 cout << "firstNum = " << firstNum << ", secondNum = " << secondNum << ", z = " << z << ", ch = " << ch << endl; firstNum = 2 * secondNum + static_cast<int>(z);
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.

Page1 / 2

Example2_18 - #include &lt;iostream&gt; # #include...

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