SOLUTION_3

SOLUTION_3 - CS 31 Introduction to Computer Science I UCLA...

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

View Full Document Right Arrow Icon
CS 31: Introduction to Computer Science I: Winter 2009: Project 3 Solution Page 1 // UCLA Winter 2009 // CS 31 Project 3 // John A. Rohr // February 3, 2009 // // // This program reads text lines. For each input line, an output line is // generated and displayed that contains all the words in the input line // in alphabetical order separated by a single space. All characters in // each output line are lower case except that the first word of each // output line is capitalized. // // Each input and output line is separated by one blank line. // // The program terminates when an input error occurs or an empty input // line is read. // // // Example // // WORD ARRANGER // // Input::a // Output:A. // Input line characters:1 // Output line characters:2 // Number of input words:1 // Number of output words:1 // // Input::a b // Output:A b. // Input line characters:3 // Output line characters:4 // Number of input words:2 // Number of output words:2 // // Input::b a // Output:A b. // Input line characters:3 // Output line characters:4 // Number of input words:2 // Number of output words:2 // // Input::a b c d e // Output:A b c d e. // Input line characters:9 // Output line characters:10 // Number of input words:5 // Number of output words:5 //
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS 31: Introduction to Computer Science I: Winter 2009: Project 3 Solution Page 2 // Input::e d c b a // Output:A b c d e. // Input line characters:9 // Output line characters:10 // Number of input words:5 // Number of output words:5 // // Input::b c a e d // Output:A b c d e. // Input line characters:9 // Output line characters:10 // Number of input words:5 // Number of output words:5 // // Input::a b c d e g f j k // Output:A b c d e f g j k. // Input line characters:17 // Output line characters:18 // Number of input words:9 // Number of output words:9 // // Input::k r h z w h x s d h w // Output:D h k r s w x z. // Input line characters:21 // Output line characters:16 // Number of input words:11 // Number of output words:8 // // Input::abc defgh // Output:Abc defgh. // Input line characters:9 // Output line characters:10 // Number of input words:2 // Number of output words:2 // // Input::these are words // Output:Are these words. // Input line characters:19 // Output line characters:16 // Number of input words:3 // Number of output words:3 // // Input::longer and more interesting words // Output:And interesting longer more words. // Input line characters:41 // Output line characters:34 // Number of input words:5 // Number of output words:5 //
Background image of page 2
CS 31: Introduction to Computer Science I: Winter 2009: Project 3 Solution Page 3 // Input::NOW ALL CAPS // Output:All caps now. // Input line characters:18 // Output line characters:13 // Number of input words:3 // Number of output words:3 // // Input::thIs LinE hAS MixEd CaPs // Output:Caps has line mixed this. // Input
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/12/2009 for the course CS 31 taught by Professor Melkanoff during the Winter '00 term at UCLA.

Page1 / 14

SOLUTION_3 - CS 31 Introduction to Computer Science I UCLA...

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

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