SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Stuart Reges, Marty Stepp
Chapter:
File Processing
Exercise:
Programming Projects
Question:5 | ISBN:9780136091813 | Edition: 2

Question

Write a program that plays a game where a player is asked to fill in various words of a mostly complete story without being able to see the rest. Then the user is shown his/her story, which is often funny. The input for your program is a set of story files, each of which contains “placeholder” tokens surrounded by < and >, such as:
One of the most <adjective> characters in fiction is named
"Tarzan of the <plural-noun> ." Tarzan was raised by a/an
<noun> and lives in the <adjective> jungle in the
heart of darkest <place> .

The user is prompted to fill in each of the placeholders in the story, and then a resulting output file is created with the
placeholders filled in. For example:

Input file name? story1.txt
Please enter an adjective: silly
Please enter a plural noun: socks
Please enter a noun: tree
Please enter an adjective: tiny
Please enter a place: Canada
The resulting output story would be:
One of the most silly characters in fiction is named

"Tarzan of the socks ." Tarzan was raised by a/an
tree and lives in the tiny jungle in the
heart of darkest Canada .

 

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Sorry the answer is not available at the moment…

If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.

Spread the 'tradition of sharing'.