Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
Question
Book Icon
Chapter 13, Problem 10PP
Program Plan Intro

Creation of program to display result of computation of Reverse polish Notation

Program Plan:

  • Define a file “Stack.h” to declare operation and methods in stack.
    • Define a structure “StckNde” that contains data and link to next node as members.
    • Define a class “Stack” to define methods and prototypes.
      • Define function prototypes for methods in program.
  • Define a file “Stack.cpp” to define operations and methods in stack.
    • Define a constructor “Stack()” to create an empty stack.
    • Define a destructor “~Stack()” to destroy a stack.
    • Define a method “empty()” to check whether stack is empty.
    • Define a method “pop()” to remove top element of stack.
    • Define a method “datatyeCon()” to display error if stack is empty.
    • Define a method “operator=()” to define operation for “=” operator.
    • Define a method “operator==()” to define operation for “==” operator.
  • Define a file “Main.cpp” to call methods in stack and perform all computations.
    • Declare variables required for the program.
    • Get expression from user.
    • Check for operators and operands.
    • Define a switch case to perform different computations in expression.
    • Display result of operation.

Blurred answer
Students have asked these similar questions
Design and implement an application that reads a sentence fromthe user and prints the sentence with the characters of each wordbackwards. Use a stack to reverse the characters of each word.8. Pop the infix expression off the stack and print it.
Code with comments and output screenshot is must for an Upvote   Create a Java function that uses a stack and no arithmetic to compare the number of 0's and 1's in a string. If # of 0's is greater, return -1. If # of 1's is greater, return 1. If equal, return 0.
Try a spatuladef pancake_scramble(text):Analogous to flipping a stack of pancakes by sticking a spatula inside the stack and flipping over the stack of pancakes resting on top of that spatula, a pancake flip of order k performed for the text string reverses the prefix of first k characters and keeps the rest of the string as it were. For example, the pancake flip of order 2 performed on the string 'ilkka' would produce the string 'likka'. The pancake flip of order 3 performed on the same string would produce 'klika'.A pancake scramble, as defined in the excellent Wolfram Challenges programming problems site, consists of the sequence of pancake flips of order 2, 3, ... , n performed in this exact sequence for the given n-character text string. For example, the pancake scramble done to the string 'ilkka' would step through the intermediate results 'likka', 'kilka', 'klika' and 'akilk'. This function should compute and return the pancake scramble of its parameter text string. text…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning