Algorithm of the program

Assignment Help Business Management
Reference no: EM131601380

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

Questions Cloud

The nasws social work core values and waldens mission : Consider the similalites between the NASW'S Social Work core values and Waldens mission and vision.
Configuration and troubleshooting of complex : Explain and demonstrate competence in the configuration and troubleshooting of complex EIGRP networks
Generate a random number between 0 and 4 : Add a function to get the current date and time. Write the date on the page in a user friendly format. Use a switch statement to write an appropriate greeting
How the economy impacts on peoples behaviour : You may want to consider for instance how the economy impacts on people's behaviour - ask how that then will have consequences for the hotel chain?
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.
Define the equal to a criminal enterprise : In sum, are monopolies simply a component of free market capitalism, or are they equal to a criminal enterprise
Recommend for sam home-based office : What firewall configuration would you recommend for Sam's home-based office/network? Justify your response.
Discuss how incidents or accidents have been brought : discuss how incidents or accidents have been brought about due to bad maintenance practices in the aviation industry.
Code to read a csv file : You have the code to read a .csv file but now you need to prompt the user to pick an option 1-5 - Next you have to assoicate the users input with the answer

Reviews

Write a Review

Business Management Questions & Answers

  Human resource management - ethics with an

human resource management - ethics with an organizationtopic based upon your personal experiences in the military andor

  Tax-deductible interest

Given that an S&L is willing to lend money at an loan-to-value ratio of 75 percent. How much, if any, of this line would qualify as tax-deductible interest if their house originally cost $200,000?

  Write the given essay assignment

Write the given essay assignment by describing your vision for your career once you have completed your master's degree.

  Masculine or feminine values

Does your selected country appear to be individualistic or collectivist? To what degree is the country individualistic or collectivist (high, medium, or low)? How is that different from the U.S.? Does your selected country appear to have masculine..

  Integrative course project

Create an imaginary company that you have been operating in the domestic arena fro some time. You represent top management, and you have decided to "go international."

  Calculation of odds ratio and relative risk

Calculation of Odds Ratio and Relative Risk

  Employee whistle-blowing

Provide an example where employee whistle-blowing is justified and an example of where it is not. Provide support for each example. (ch. 16)

  Fraud triangleexperts have identified the fraud triangle 1

fraud triangleexperts have identified the fraud triangle 1 the opportunity to act dishonestly 2 an incentive or

  Ethical principal for supply managers

In your opinion, what is the most ethical principal for supply managers. Explain why.

  Develop a database to maintain details of the football

You have been asked to develop a database to maintain details of the football teams signed up to play in a local league, including the schedule.

  Transformational and transactional leadership

Carefully review the concepts and definitions of charismatic, transformational, and transactional leadership. Then write a three-page paper addressing the following issues, using specific examples from your personal experiences. Make sure to cite ..

  Integration of risk management

Assume you work for a major defense contractor. Your corporation prepared and submitted a bid for a recent Department of Defense RFP, entitled Automated Mobile Defense System.

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