Assignment #6

Due: Monday, July 31

Objective

This assignment will involve practice with C-style strings, as well as some of the libraries that involve manipulations on characters and strings.

Task

Write the following exercises, each in a separate file. Filenames should be: (Note that the filenames are all lowercase)

Exercise 1

Filename: textline.c

Do exercise 8.6 (page 357) from the textbook. Follow the instructions in the exercise, as well as the following:

Sample Runs

(user input is underlined, to distinguish it from output)

Sample Run 1

Input a line of text, up to 99 characters:
> The quick brown fox jumped. The lazy dog, he was jumped over.

Uppercase output:
THE QUICK BROWN FOX JUMPED. THE LAZY DOG, HE WAS JUMPED OVER.

Lowercase output:
the quick brown fox jumped. the lazy dog, he was jumped over.

Original string:
The quick brown fox jumped. The lazy dog, he was jumped over.

Sample Run 2

Input a line of text, up to 99 characters:
> Mary Had A Little Lamb. His name was Fleecy Pete.

Uppercase output:
MARY HAD A LITTLE LAMB. HIS NAME WAS FLEECY PETE.

Lowercase output:
mary had a little lamb. his name was fleecy pete.

Original string:
Mary Had A Little Lamb. His name was Fleecy Pete.

Exercise 2

Filename: sentences.c

Do exercise 8.11 (page 358) from the textbook. Follow the instructions in the exercise, as well as the following:

Sample Run

Note that your outputs will vary, because this depends on random number generation.
Programming Exercise 8.11: Sentences

The girl ran to a town.
Any girl jumped under one car.
Any town jumped to the boy.
The car ran to some boy.
A boy jumped to a town.
Some town skipped from a town.
Any boy jumped under the town.
One girl jumped to a car.
The town walked over some dog.
Any girl skipped to some dog.
Any dog drove to some girl.
Some car walked to one boy.
The girl jumped over a car.
A girl skipped from the dog.
The boy drove on one car.
A girl jumped on one girl.
One dog drove under any boy.
Some boy jumped over one boy.
Some boy walked under a car.
One dog skipped to some town.

Exercise 3

Filename: piglatin.c

Write a function, called PrintPigLatin, which is described below:

Sample Runs

(user input is underlined, to distinguish it from output)

Sample Run 1

Input 5 words: Flower yellow bypass apple Igloo

Pig Latin version of the 5 words:
Owerflay ellowyay ypassbay appleway Iglooway

Sample Run 2

Input 5 words: string Hamburger Rhythm queen zippitydoodah

Pig Latin version of the 5 words:
ingstray Amburgerhay Ythmrhay ueenqay ippitydoodahzay

Requirements for all programs


Submitting:

Submit only your source code files through the web submission page. This will consist of the following files:
  textline.c
  sentences.c
  piglatin.c