Algorithm of the program

Assignment Help Business Economics
Reference no: EM131596537

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: EM131596537

Questions Cloud

The focus of your teams project : Provide a description of the brand that will be the focus of your team's project.Discuss things such as the use of the Internet, social media, apps etc.
Rate of interest was used in the present value computation : What rate of interest was used in the present value computation? Assume interest is compounded annually.
Conflicting goals of convenient resource sharing : Operating systems have to balance the conflicting goals of convenient resource sharing and protection against unauthorized resource access.
Do you have three to five main points of analysis : Does the paper give examples of what is and what is not employment? Do you have three to five main points of analysis?
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.
Did your company have any preferred stock at year end : Did your company have any preferred stock at year end? How much of the company's common stock was outstanding at year end
Discuss the terms socially-emotionally and cognitively : Initial Post: Select a topic from Chapter 2 or 3 of your textbook that interests you (ex: influence of genetics, family structures, culture, economics.
Does the introduction explain what the paper is about : Does the introduction explain what the paper is about? Does it give a quick overview of pros and cons analysis? Does the paper follow APA Guidelines?
Compute the basic earnings per share for the company : Compute the basic earnings per share for the company. What method does the company use to report net cash flows from operating activities? How can you tell

Reviews

Write a Review

Business Economics Questions & Answers

  Effective customer acquisition-retention and development

Multichannel customer management is “the design, deployment, and evaluation of channels to enhance customer value through effective customer acquisition, retention, and development” (Neslin et al. 2006). Are there any differences in the way multichan..

  What is the present worth of series of equal payments

What is the present worth of a series of equal payments of $5000 made every two years for the following time frames? The nominal interest rate is 8%. For a period of 40 years? In perpetuity?

  Explain the economic effects of spillover benefits

Explain the economic effects of spillover benefits? Thoroughly and completely explain how spillover benefits are corrected and the economic implications of the corrections?

  Annual net cash flow after depreciation

(a) Determine the annual net cash flow after depreciation and taxes for years 1-5. (b) Determine the internal rate of return.

  Average variable cost function for electricity generation

A study of the costs of electricity generation for a sample of 56 British firms in 1946-1947 yielded the following long-run cost function: Determine the long-run average variable cost function for electricity generation. Determine the long-run margin..

  Utility subject to his budget constraint

Cory has the utility function U(X,Y) = X + 16*root(Y) , where X is the quantity of water consumed, and Y is the quantity of coffee consumed. Let the price of water be Px = 1 and the price of coffee be Py = 4. Let I represent income. If I = 8 what are..

  Gasoline is an exception to the law of demand

As the price of gasoline ranges from $3.00 to over $4.00 a gallon in a year, the amount of gasoline bought remains about the same; does this mean that gasoline is an exception to the law of demand or is there some better explanation?

  Treasury consistently have lower yields than bonds mainly

Bonds issued by the U.S. Treasury consistently have lower yields than other bonds mainly because:

  Risk-free rate of interest in economy

1. Calculate the portfolio weights that remove all risk. 2.If there are no arbitrage opportunities, what is the risk-free rate of interest in this economy?

  Estimate a security market line

In this assignment, you are to estimate a security market line. You have current information about beta and expected annual return.

  Define opportunity cost of getting your degree by analyzing

Define the opportunity cost of getting your degree by analyzing what steps and economic factors a potential student must make when choosing to pursue an education. Given your answer, is getting a formal college education worth your opportunity costs?..

  Put money into an account

You put money into an account. One year later you see that you have 5 percent more dollars and that your money will buy 6 percent more goods.

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