C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 12, Problem 12.13E
Program Plan Intro

Program Plan:

  • Use stack implementation as provided in figure 12.08 of the book.
  • Define a function calculate as mentioned. Inside this function use switch statement to evaluate value of operands as per operator.
  • Define function evaluatePostfix() that take one argument exp which a pointer of type char. Inside this function create a stack pointer.
  • Further scan character of expression in exp pointer character by character and then use push, pop and calculate functions to evaluate the expression and return final value.
  • Define main function. Inside main read postfix expression from user and call evaluatePostfix function using the read expression.

Program Description:

The followingprograms evaluate the postfix expression using stacks.

Blurred answer
Students have asked these similar questions
Finish the swap function below using pointers and write the call to swap in the reverse function using the address of the array positions array[i] and array[size-i-1].using pointers. DON'T FORGET TO DECLARE THE PARAMETERS in the function. (Hint: if you can't figure it out with pointers, do it with the references    #include <iostream>using namespace std; // Function to swap two ints using pointers// @param pointer to an int// @param pointer to an intvoid swap( ) {// TODO: Add code that swaps two integers using pointers   } // Function to reverse arrayvoid reverse(int a[], int size) {for (int i = 0; i < size/2; i++) {// TODO: write the call to swap in the reverse function using the // address of the array positions array[i] and array[size-i-1].
1-Write a C++ program to input elements in array and sort array elements in  descending order. How to sort array in descending order in using pointers.Use function to print out the original and sorted arrays, Example Input Input size of array: 10  Input array elements: 20, 2, 10, 6, 52, 31, 0, 45, 79, 40  Output Array sorted in descending order:  79 ,52,45,40,31,20,10,6,2,0
by using c++. How can I solve this? Kindly, no class, linked list, and pointers shall be used in this program. Kindly use only SELECTION, ITERATION, INPUT, AND OUTPUT, FUNCTION,  ARRAY, AND STRING ONLY.
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
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr