STARTING OUT WITH C++ MPL
STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
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
C++ Plz solve as you can quickly
C++ Code: This function will print out the information that has been previously read (using the function readData) in a format that aligns an individual's STR counts along a column. For example, the output for the above input will be: name Alice Bob Charlie ---------------------------------------- AGAT 5 3 6 AATG 2 7 1 TATC 8 4 5 This output uses text manipulators to left-align each name and counts within 10 characters. The row of dashes is set to 40 characters. /** * Computes the longest consecutive occurrences of several STRs in a DNA sequence * * @param sequence a DNA sequence of an individual * @param nameSTRs the STRs (eg. AGAT, AATG, TATC) * @returns the count of the longest consecutive occurrences of each STR in nameSTRs **/ vector<int> getSTRcounts(string& sequence, vector<string>& nameSTRs) For example, if the sequence is AACCCTGCGCGCGCGCGATCTATCTATCTATCTATCCAGCATTAGCTAGCATCAAGATAGATAGATGAATTTCGAAATGAATGAATGAATGAATGAATGAATG and the vector namesSTRs is…
C++ - Vowels and Consonants
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