CSC1310: LAB 6 File Reverser using Stacks

$30.00 $24.00

Concepts Stacks Files DESCRIPTION Write a program that reads an entire text file (provided) and then prints to a separate text file all the data, but in reverse order. The resulting file should be the best movie quotes from the movie Steel Magnolias (https://www.imdb.com/title/tt0098384/) Specifications STACK Class (stack.h) You will have a header file that…

Rate this product

You’ll get a: zip file solution

 

Categorys:

Description

Rate this product

Concepts

  • Stacks
  • Files

DESCRIPTION

Write a program that reads an entire text file (provided) and then prints to a separate text file all the data, but in reverse order.

The resulting file should be the best movie quotes from the movie Steel Magnolias (https://www.imdb.com/title/tt0098384/)

Specifications

STACK Class (stack.h)

You will have a header file that contains a Stack class specification and member function definitions. This should be a template class that can accept any data type. The stack should be implemented using a linked list.

The Stack class should have the following member functions:

  • Constructor
  • Push
  • Pop
  • isEmpty

fileReverser.cpp

Name your program fileReverser.cpp.

Your program should use your Stack class.

In order to write a text file in reverse to a separate file, you will have to open the text file (named file1.txt) and read its contents into a stack of characters. Then, pop those characters from the stack and save them in a second text file (named file2.txt).

This resulting file should contain a readable file of Steel Magnolias movie quotes.

sample output

command prompt

Opening file1.txt as input.

Opening file2.txt as output.

Reading one character at a time from file1.txt and pushing the character on the stack.

Done reading all of file1.txt. All characters from the file have been pushed on the stack.

Popping one character at a time from the stack and writing the character to file2.txt.

Done! See your results in file2.txt.

file2.txt

Ouiser Boudreaux: I’m not crazy, I’ve just been in a very bad mood 40 years!

Clairee Belcher: Well, you know what they say: if you don’t have anything nice to say about anybody, come sit by me!

Clairee: Ouiser, you sound almost chipper. What happened today – you run over a small child or something?

M’Lynn: [crying] I’m fine, I’m fine, I’m fine.

[screaming]

M’Lynn: I’m fine! I can jog all the way to Texas and back, but my daughter can’t! She never could! Oh God! I am so mad I don’t know what to do! I wanna know why! I wanna know *why* Shelby’s life is over! I wanna know how that baby will *ever* know how wonderful his mother was! Will he *ever* know what she went through for him! Oh *God* I wanna know *why*? *Why*? Lord, I wish I could understand!

[in a firm tone]

M’Lynn: No! No! No! It’s not supposed to happen this way! I’m supposed to go first. I’ve always been ready to go first! I-I don’t think I can take this! I-I don’t think I can take this! I-I just wanna *hit* somebody ’til they feel as bad as I do! I just wanna hit something! I wanna hit it hard!

[continues sobbing]

Clairee: Here!

[grabs Ouiser by the shoulder and positions her in front of M’Lynn]

Clairee: Hit this! Go ahead M’Lynn, slap her!

Ouiser Boudreaux: [taken aback and confused] Are you crazy?

Clairee: Hit her!

Ouiser Boudreaux: Are you *high*, Clairee?

Truvy: [in a frightened tone] Clairee, have you lost your mind?

Clairee: We’ll sell t-shirts sayin’ “I SLAPPED OUISER BOUDREAUX!” Hit her!

Annelle: [in a scared tone] Ms. Clairee, enough!

Clairee: Ouiser, this is your chance to do something for your fellow man! Knock her lights out, M’Lynn!

Ouiser Boudreaux: [snatches away] Let go o’ me!

Clairee: M’Lynn, you just missed the chance of a lifetime! Half o’ Chiquapin Parish’d give their eye teeth to take a whack at Ouiser!

Clairee Belcher: Ouiser, I’d recognize this penmanship anywhere. You have the handwritin’ of a serial killer.

Truvy: Laughter through tears is my favorite emotion.

Clairee Belcher: I love ya more than my luggage.

Drum: Ouiser, can we call a truce long enough for me to get a piece of cake?

[Ouiser slices him the tail piece of an armadillo cake]

Drum: Aww, thanks Ouiser. Nothin’ like a good piece of ass.

Clairee: I’ve just been to the dedication of the new children’s park.

Truvy: Yeah, how did that go?

Clairee: Janice Van Meter got hit with a baseball. It was fabulous.

Truvy: Was she hurt?

Clairee: I doubt it. She got hit in the head.

Shelby: Pink is my signature color.

Clairee Belcher: Ouiser could never stay mad at me; she worships the quicksand I walk on.

Truvy: Honey, time marches on and eventually you realize it is marchin’ across your face.

Ouiser Boudreaux: Yes, Annelle, I pray! Well, I do! There, I said it, I hope you’re satisfied.

Annelle: I suspected this all along!

Ouiser Boudreaux: Oh! Well don’t you expect me to come to one of your churches or one of those tent-revivals with all those Bible-beaters doin’ God-only-knows-what! They’d probably make me eat a live chicken!

Annelle: Not on your first visit!

Clairee Belcher: Very good, Annelle! Spoken like a true smart-ass!

Clairee Belcher: You know, you would be a much more contented, pleasant person if you would find ways to occupy your time.

Ouiser Boudreaux: I’m pleasant. Damn it! I saw Drum Eatenton this morning at the Piggly Wiggly, and I smiled at the son of a bitch ‘fore I couldn’t help myself.

Ouiser Boudreaux: A dirty mind is a terrible thing to waste.

Clairee Belcher: The only thing that separates us from the animals is our ability to accessorize.

Annelle: We are in the house of the Lord!

Clairee Belcher: Oh like she cares. Ousier’s never done a religious thing in her life.

Ouiser Boudreaux: Now that is not true. When I was in school, a bunch of my friends and I would dress up as nuns and go bar-hoppin’.

Truvy: Smile! It increases your face value.

Truvy: There’s so much static electricity in this room, I pick up everything but boys and money.

What to Turn In

Zip all the following files and upload to ilearn.

  • fileReverser.cpp
  • Stack.h
  • file1.txt
  • file2.txt
CSC1310: LAB 6 File Reverser using Stacks
$30.00 $24.00