010_Problem_Set_0

010_Problem_Set_0 - CS106L Fall 2009 Handout #01 October...

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

View Full Document Right Arrow Icon
CS106L Fall 2009 Handout #01 October 13, 2009 Problem Set 0 _________________________________________________________________________________________________________ Due October 22, 2009, 11:59PM Now that you've gotten a chance to see C++ in action, it's time to get your hands dirty and experiment with the material we've covered so far. This problem set will be an excellent starting point for you to ex- plore exactly how much firepower C++ packs. There are seven questions in this problem set, of which you only need to complete five to receive credit. That is, you can skip two of the questions without penalty. Of course, I recommend completing all of the exercises, since each question considers a different aspect of C++, but you are under no compulsion to do so. You will probably want to have the course reader on-hand while answering these questions, as well as the lecture code that has been posted on the CS106L website. As always, feel free to email me with questions at htiek@cs.stanford.edu . Good luck! Question 0 (Adjusting to the Compiler) You might want to read Chapter 1 of the course reader before answering this question. Before playing around with the material we've covered this quarter, let's get warmed up by setting up a C++ project for compilation. If everything goes well, once you're done with this question you'll know how to compile and run C++ programs. On the CS106L website I've provided a highly obfuscated C++ program called sample.cpp that per- forms a simple task. Download sample.cpp , compile it, and run it. What does the program do? (Note: this is not the RickRoll program from lecture! You will actually need to compile this program to see what it does.) Question 1 (Console I/O) You might want to read Chapter 3 of the course reader before answering this question. Modify the code for GetInteger (found either on page 38 of the course reader or on the CS106L web- site) to create a function GetReal that reads a real number from the user. How much code did you need to change? - 1 -
Background image of page 1

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

View Full DocumentRight Arrow Icon
Question 2 (The X Macro Trick) You might want to read Chapter 13, especially the latter half of the chapter, before answering this ques- tion. Suppose that you are given the following
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.

Page1 / 4

010_Problem_Set_0 - CS106L Fall 2009 Handout #01 October...

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