Starting Out with C++: Early Objects (9th Edition)
Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
bartleby

Videos

Question
Book Icon
Chapter 14, Problem 11PC
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
pointers as Arguments:In the C programming language there is no pass-by-reference syntax to passa variable by reference to a function. Instead a variable is passed by pointer(just to be confusing, sometimes passing by pointer is referred to as pass byreference). This Practice Program asks you to do the same thing as C.Here is the header for a function that takes as input a pointer to an integer:1. void addOne (int ∗ptrNum )Complete the function so it adds one to the integer referenced by ptrNum.Write a main function where an integer variable is defined, give it an initialvalue, call addOne, and output the variable. It should be incremented by 1.
C programming language question
C++ Plz solve as you can quickly
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
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
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
.2: Function Parameters and Arguments - p5.js Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=zkc417YapfE;License: Standard Youtube License