assn2_soln - MIT OpenCourseWare http:/ocw.mit.edu 6.096...

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

View Full Document Right Arrow Icon
MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .
Background image of page 1

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

View Full DocumentRight Arrow Icon
Massachusetts Institute of Technology 6.096 Lab 2 Solutions Problem 1: (8/70) i. The program takes 2 inputs from the user, and stored it in variables input and a . ii. If the user has inputted the value of input as 1- a. the string choice will be assigned value “Hello World”. b. In the if-else construct, the condition returned to the if statement will be a>1. Now, if this condition is true (i.e if a>1), then Why did you pick "Hello World"? will be displayed. c. If this returned condition is false, (i.e if a<1), then Yay you picked Hello World will be displayed. iii. If the user has inputted the value of input as 0- a. the string choice will be assigned value “I love C++”. b. In the if-else construct, the condition returned to the if statement will be a<1. Now, if this condition is true (i.e if a<1), then
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 11/14/2011 for the course DDDD h0322 taught by Professor Whoknow during the Spring '11 term at Bina Nusantara University.

Page1 / 5

assn2_soln - MIT OpenCourseWare http:/ocw.mit.edu 6.096...

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