Algorithm of the program

Assignment Help Basic Computer Science
Reference no: EM131602266

For this exercise you are to write a program (in C or C++ preferably) that reads a text file containing a number of words and displays the words on the screen in reverse order using a stack. An algorithm of the program is shown below:

Begin main

Display a prompt for the file name

Read in the file name

Try to open the file

If the file fails to open

Print an error message on the screen and exit

Loop

Read in a word from the file

If the file read fails, terminate (break) the loop

Push the word onto the stack

End loop

Close the file

While the stack is not empty

Display the top stack word on the screen followed by a space

Pop the top value from the stack

End while

End main

Do not implement the stack using a class or struct or with STL. The stack must be implemented using a fixed size array of words and an index integer for indicating the top of the stack. The stack array and index should be global variables. A word can be a string or a c-string (i.e. a character array). You can assume no word is more than 20 characters long. The stack functions (i.e. push(), top(), pop(), isEmpty() ) should be implemented below the main() and prototyped above the main().

Reference no: EM131602266

Questions Cloud

What are the typical stock price reactions : When one public company acquires another public company, what are the typical stock price reactions? Why does this happen?
Protection of intellectual property : Many people download movies, music, and software to a computer. Streaming services for downloading such applications are common on personal computers.
Discuss the given curve graph : Label points A, B, C, D, E, and F on the graph of y = f(x) in Figure.Point A is a point on the curve where the derivative is negative.
What is its intrinsic value per share : The stock’s last dividend was $0.94 per share and dividends are expected to grow forever at constant rate of 7.2% per year. What is intrinsic value per share.
Algorithm of the program : For this exercise you are to write a program (in C or C++ preferably) that reads a text file containing a number of words and displays the words on the screen.
What is its annual yield to maturity : If the bond’s price is $1,067.32, what is its annual yield to maturity?
Both bonds pay annual interest-yields to maturity : You own two bonds. Both bonds pay annual interest, have 8 percent annual coupons, $1,000 face values, and currently have 8 percent yields to maturity.
What will your company repayment-issue the zeros : what will your company's repayment be if you issue the coupon bonds? What if you issue the zeros?
Find approximate the instantaneous rate of change : Make a table of values, rounded to two decimal places, for f(x) = log x (that is, log base 10) with x = 1, 1.5, 2, 2.5, 3.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Simulate the program in the pic18f

Write a program to add 7F9AH to BC48H, and save the result in RAM memory locations starting at 40H. Include a flow chart. Simulate the program in the PIC18F simulator ide and attach the simulation screenshot.

  Hired to test a parking lot calculation application

You are hired to test a parking lot calculation application. This application is provided for the convenience of travelers that use a certain parking lot, and provides them with an estimate of the cost they should expect to pay when parking on tha..

  What is the index of the component that is deleted

a. What is the index of the component that is deleted? b. What is the index of the component that takes its place? c. What does the Length operation return after the deletion? d. How many components in the list change their positions as a result o..

  Describe the overall shapes of these distributions

Deaths 2003. A National Vital Statistics Report (www.cdc.gov/nchs/) indicated that nearly 300,000 black Americans died in 2003, compared with just over 2 million white Americans. Below are histograms displaying the distributions of their ages at d..

  Describe three main types of testing

What is Camtasia and why would you use it? What is the Windows Snipping Tool and why would you use it?

  Determining the course takeaway

From the lessons and conceptual ideas presented in this course, determine the single most impactful or interesting lesson / concept you have learned. Provide a rationale for your response.

  Designs a comprehensive security solution

Designs a comprehensive security solution that meets the needs of an organization; includes solutions that show insight into securing and organization's data

  What is the fcs field for

What is the FCS field for? What are start and stop indicator flags? What is CRC and what is it for?

  Advantages of using it include visibility

Consider the role of IT in the supply chain. Some of the advantages of using IT include visibility, consumer behavior, competition, and speed. Select one advantage, and describe how IT improves the supply chain by using that advantage. Include a r..

  Non-isomorphic graphs with the degree sequence

1.Show that if two graphs have the same degree sequence then they have the same number of vertices and the same number of edges. Find two non-isomorphic graphs with the degree sequence (2, 2, 2, 1, 1)

  How are they weatherstripped

Do these windows make sense to you in terms of today's energy efficiency requirements and your own feelings about the room? How would you change them?

  P needed to raise the column and the equilibrium

The contacting surface between A and D is smooth.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd