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

  Economics assignment

This document contains various important questions and their appropriate answers in the subject field of Economics.

  Demand and supply curves

Economics is the study of the principles governing the allocation of scarce means among competing ends when the objective of the allocation is to maximize the attainment of the ends.

  Long-run perfectly competitive equilibrium for the firm

Evaluate Government intervene and correct this situation?(a) Explain the concept of a concentration ratio. A rise in the price of magarine Explain the impact of external costs and external benefits on resource allocation long-run perfectly c..

  Supply and demand diagrams

Explain each of the following using supply and demand diagrams,  With the use of a graph, explain how these two programs affect cigarette consumption and the price of cigarettes.

  Case study: fisher-price toys

The case study of the Fisher-Price Toys, Inc., a popular case in basic economics and management from the prestigious Harvard Business School.

  Draw the production possibility curve

Draw the production possibility curve and a. Define consumer surplus and producer surplus.

  Tax revenue

The Australian government administers two programs that affect the market for cigarettes

  Maximize total welfare

How many tickets to sell to maximize total welfare.

  Difference between the cv and the ev

The change in consumer surplus (?CS) is not "theoretically" justifiable like the CV and EV but it continues to be the most widely used measure of consumer welfare change. Explain how this can be reconciled

  Depict von neumann-morgenstern utility index u in a diagram

Depict the von Neumann-Morgenstern utility index u in a diagram

  What is the market solution

What is the market solution (market price and quantity) and What is the total surplus of the society under the market solution

  Calculate gross national product and net national product

Calculate gross national product and net national product

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