CISP 1010, Lab 3, Arrays and C-Strings Introduction This application creates Mad Lib™M haikus based upon user input. Detailed Information The application reads three-line haikus into a two-dimensional array of characters (an array of C-strings, not C++ string objects) from an input file called haikus.dat. Do not ask the user for this file name. Just open it and read its contents into a two-dimensional array. A sample input file with two haikus is shown below. Flowers sit in Shades of the * tree near * in sunset When begins the * And the * Crocus blooms * any thing The asterisk will actually be in the file. They indicate where words that the user enters go in the haiku. The asterisk on the first line will be replaces by a one syllable noun and on the second line will be replaced by a two syllable adjective. These two askterisks will never be the first character of the line. The asterisk on the third line will always be the first character on the line and will be replaced by a gerund (a verb ending in “ing" such as "asking") whose first character the program will have to capitalize. The two dimensional array of characters for the sample input file is shown below. F10wers Sit| Shade 55 0f| i n 5unset \0 When begins And the Cr 0cuS | a n|y| |thing\0 Assume that no one line of a haiku will be longer than 50 characters and have space in the array for no more than 30 haikus from the input file haikus.dat. Since the input file might have more or less than 30 haikus, the program code must handle these situations by reading until the end of the file but not reading more than 30 in \0 he t t ee ne a the |b10 0 m5 \0| hailne Thoe will hn no nartial haikue in the innut file haikus. There will be no partial haikus in the input file. After the program reads the file contents into the two-D array, it should ask the user for a one syllable noun, a two syllable adjective and a two syllable gerund. The program then randomly selects a haiku, substitutes the one syllable noun for the first * in the haiku, the two syllable adjective for the second, and the gerund for the third, and prints this new haiku. The program continues asking for words until the user doesn't type Y (or y) to continue. Error checking is described below. • If the input file, haikus.dat, does not exist, print the following error message and end the program. Haiku file non-existent. Please contact the administrator.
CISP 1010, Lab 3, Arrays and C-Strings Introduction This application creates Mad Lib™M haikus based upon user input. Detailed Information The application reads three-line haikus into a two-dimensional array of characters (an array of C-strings, not C++ string objects) from an input file called haikus.dat. Do not ask the user for this file name. Just open it and read its contents into a two-dimensional array. A sample input file with two haikus is shown below. Flowers sit in Shades of the * tree near * in sunset When begins the * And the * Crocus blooms * any thing The asterisk will actually be in the file. They indicate where words that the user enters go in the haiku. The asterisk on the first line will be replaces by a one syllable noun and on the second line will be replaced by a two syllable adjective. These two askterisks will never be the first character of the line. The asterisk on the third line will always be the first character on the line and will be replaced by a gerund (a verb ending in “ing" such as "asking") whose first character the program will have to capitalize. The two dimensional array of characters for the sample input file is shown below. F10wers Sit| Shade 55 0f| i n 5unset \0 When begins And the Cr 0cuS | a n|y| |thing\0 Assume that no one line of a haiku will be longer than 50 characters and have space in the array for no more than 30 haikus from the input file haikus.dat. Since the input file might have more or less than 30 haikus, the program code must handle these situations by reading until the end of the file but not reading more than 30 in \0 he t t ee ne a the |b10 0 m5 \0| hailne Thoe will hn no nartial haikue in the innut file haikus. There will be no partial haikus in the input file. After the program reads the file contents into the two-D array, it should ask the user for a one syllable noun, a two syllable adjective and a two syllable gerund. The program then randomly selects a haiku, substitutes the one syllable noun for the first * in the haiku, the two syllable adjective for the second, and the gerund for the third, and prints this new haiku. The program continues asking for words until the user doesn't type Y (or y) to continue. Error checking is described below. • If the input file, haikus.dat, does not exist, print the following error message and end the program. Haiku file non-existent. Please contact the administrator.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education