09-Section-Handout

09-Section-Handout - CS106X Winter 2008 Handout 09 Section...

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

View Full Document Right Arrow Icon
CS106X Handout 09 Winter 2008 January 16, 2008 Section Handout 1 Problem 1: Compiler, compiler, what do you want? You are working hard on your latest assignment and come up with the following code: enum directionT { North, East, South, West }; int main() { directionT dir = North; int num = 0; dir = num; // One of these two num = dir; // lines does not compile return 0; } One of the lines above doesn’t compile. Which line is it? Why does one line work even though the other one doesn’t? How could you fix this problem? Problem 2: Removing all occurrences of a character Write a function RemoveAllOccurrences that takes a string as input and returns the string with a given character removed. “Stanford University” with the ‘n’ removed becomes “Staford Uiversity” “Llamas like to laugh” with the ‘l’ removed becomes “Lamas ike to augh” and so on . . . Use the following function prototype to get started: string RemoveAllOccurrences(string text, char ch); Problem 3: Rot-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
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

09-Section-Handout - CS106X Winter 2008 Handout 09 Section...

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