Handout #1 solutions

Handout #1 solutions - CSE 100: Introduction to Programming...

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

View Full Document Right Arrow Icon
CSE 100: Introduction to Programming Languages Department of CSE, Arizona State University, Fall 2007 Handout #1 This is not for grading Solutions 1. Basic elements of a C++ program Token Special  Symbol Keyword Identifier Invalid double       X xyz X 123z X != X First+Name X c34p X firstName X 2. Arithmetic Operations, Operator precedence, and String data type Expression Result  20 % (4-2) 0 4 % 5 4 7*6/21/3.0 0.6666 (2-3 + (2*(3/3)%1)) -1 5+3*2 11 static_cast<float>(4)/3 1.3333 Page 1 of 2
Background image of page 1

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

View Full DocumentRight Arrow Icon
static_cast<int>(3.7) + 5.3 8.3 static_cast<double>(5/2) 2.0 static_cast<int>(3.7) + 5.3 8.3 static_cast<char>(65) A 3. What is the output of the following  code segment?  int x = 2, y=3, z=5 cout<<”This is my report columns  \n”        << ‘\t’<< x << ’\t’<< x * x << endl       << ‘\t’<< y << ’\t’<<y * y << endl       << ‘\t’ << z << ‘\t’ <<  z * z << endl; Solution:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/29/2008 for the course CSE 100 taught by Professor Computersystems during the Fall '07 term at ASU.

Page1 / 4

Handout #1 solutions - CSE 100: Introduction to Programming...

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

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