Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COSC2430: Programming and Data Structures Print a file in reverse using array-based stack Introduction In this homework, you will create a C+program that uses an

image text in transcribedimage text in transcribedimage text in transcribed

COSC2430: Programming and Data Structures Print a file in reverse using array-based stack Introduction In this homework, you will create a C+program that uses an array-based stack to read an input file and print the words in the text in reverse order. The initial size of the stack should be of size 10. Every time the stack overflows (attempt to store an item in an already full stack), you will have to create a new stack of double the size of the previous one to continue the operation Input and Output The input is a single text file containing a paragraph of unknown length. Example 1 of input Once upon a time, there was a little girl who lived in a village near the forest. Whenever she went out, the little girl wore a red riding cloak, so everyone in the village called her Little Red Riding Hood. The output of your program should be a text file containing all the words in the original file in reverse order. Only words must enter the stack. Punctuation and numbers (including words including numbers or special characters) will not be included in the output. At the end of the output, you will write the number of times the program had to double the stack to adapt to the length of the text. Example 1 of output Hood Riding Red Little her called village the in everyone so cloak riding red a wore girl little the out went she Whenever forest the near village a in lived who girl little a was there time a upon Once As you can see, this text includes 40 words, so the stack has to be double twice to fit it (once from 10 to 20, and once from 20 to 40) Example 2 of input Disguised as a human, a lethal cyborg assassin known as a Terminator travels from 2029 to 1984 to kill Sarah Connor

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions