Starting Out with C++: Early Objects
Starting Out with C++: Early Objects
8th Edition
ISBN: 9780133360929
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: Addison-Wesley
bartleby

Videos

Question
Book Icon
Chapter 14, Problem 10PC
Program Plan Intro

Prefix to Infix

Program Plan:

  • Include required header files.
  • Give function prototype “prefix_To_Infix ()”.
  • Define the function “main ()”. Inside this function,
    • Declare a string variable “prefixStr”.
    • Get the prefix string from the user and store it in a variable “prefixStr”.
    • Do until the length of the string is equal to 0 using “while” loop.
      • Create an object “isStream” for input file stream.
      • Call the function “prefix_To_Infix ()” by passing the object “isStream” as the argument.
      • Get another prefix string from the user.
    • Return the statement.
  • Give function definition for “prefix_To_Infix ()”.
    • Get the first character and store it in a variable “ch”.
    • Do until the variable “ch” detects a space using “while” loop.
      • Get a character using “get ()” function.
      • Get the first character using “peek ()” function.
    • Check if the character is a digit.
      • Declare a variable “num”.
      • Create an object “ostr” from output string stream.
      • Get and print the number.
      • Return the object.
    • Else,
      • Get the character using “get ()” function and store it in a variable “ch”.
      • Call the function “prefix_To_Infix ()” and store the returned expression in a string variable “expr1”.
      • Call the function “prefix_To_Infix ()” and store the returned expression in a string variable “expr2”.
      • Check if the character is not any mathematical symbol like “+”, “-”, “*” and “/”.
        • Exit.
      • Return “expr1”, “ch”, and “expr2” .

Blurred answer
Students have asked these similar questions
whats for dinner? please
Consider the follow program that prints a page number on the left or right side of a page. Define and use a new function, isEven, that returns a Boolean to make the condition in the if statement easier to understand. ef main() :   page = int(input("Enter page number: "))   if page % 2 == 0 :      print(page)   else :      print("%60d" % page)   main()
What is the correct python code for the function def countWords(string) that will return a count of all the words in the string string of workds that are separated by spaces.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
.2: Function Parameters and Arguments - p5.js Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=zkc417YapfE;License: Standard Youtube License