WordWrap - function WordWrap(infn,outfn,numin) %Given a...

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

View Full Document Right Arrow Icon
function WordWrap(infn,outfn,numin) %Given a .txt file containing long lines of text, write a function called % wordWrap that formats the text given in the original file according to the % following rules, and writes this modified text to a file whose name % is specified by the 'Output file name' parameter. % Rules: % 1) Each line in the output file will contain n words, where n is an input. % If n words aren't available, then as many words as possible will be on % that particular line. % 2) Text from different lines from the input file will be seperated in the % output file by a blank newline. % 3) Each and every word must be followed by a space. % 4) Characters such as ' - , . ' aren't considered to be words, therefore % they shouldn't affect the word length of each line. So, 'really-long' is % one word. % A word is anything set apart from it's surrounding text by spaces. So, % "The number 12" would be three words. %usage: WordWrap(infn,outfn)
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.

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.

Page1 / 2

WordWrap - function WordWrap(infn,outfn,numin) %Given a...

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