Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
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” .
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents 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
Chapter 14 Solutions
Starting Out with C++: Early Objects (9th Edition)
Ch. 14.1 - What is a recursive functions base case?Ch. 14.1 - What happens if a recursive function does not...Ch. 14.1 - Prob. 14.3CPCh. 14.1 - What is the difference between direct and indirect...Ch. 14 - What type of recursive function do you think would...Ch. 14 - Which repetition approach is less efficient; a...Ch. 14 - When should you choose a recursive algorithm over...Ch. 14 - Prob. 4RQECh. 14 - Prob. 5RQECh. 14 - Prob. 6RQE
Ch. 14 - Predict the Output 7. What is the output of the...Ch. 14 - Soft Skills 8. Programming is communication; the...Ch. 14 - Prob. 1PCCh. 14 - Recursive Conversion Convert the following...Ch. 14 - Prob. 3PCCh. 14 - Recursive Array Sum Write a function that accepts...Ch. 14 - Prob. 5PCCh. 14 - Recursive Member Test Write a recursive Boolean...Ch. 14 - Prob. 7PCCh. 14 - Prob. 8PCCh. 14 - Ackermanns Function Ackermanns function is a...Ch. 14 - Prefix to Postfix Write a program that reads...Ch. 14 - Prob. 11PCCh. 14 - Prob. 12PC
Knowledge Booster
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
- C questionarrow_forwardC++arrow_forwardNote:solution using c++ language Pre-Lab 01: Write a program that reads a positive integer x from the user. If x is even, the program prints all the odd numbers between 1 and x – inclusive - each on a separate line. If x is not even, the program prints all the numbers that are multiples of 4 between 1 and x+10 -inclusive -, each on a separate line. Note: As long as the user does not enter a positive number, the program will repeatedly ask the user to enter a positive number. The program must also print an error message "Error- TRY AGAIN – You should enter a positive integer to continue". Úe do.. while to insure the user input.arrow_forward
- Expression in which operator is written after operand is called as a. Infix Expression b. Prefix Expression c. Postfix Expression d. Enfix Expressionarrow_forwardOption #1: String Values in Reverse Order Assignment Instructions Write a Python function that will accept as input three string values from a user. The method will return to the user a concatenation of the string values in reverse order. The function is to be called from the main method. In the main method, prompt the user for the three strings.arrow_forwardLISP Function help please LISP Programming only A function that generates a random day of the week, then displays a message saying that "Today is ... and tomorrow will be ...". Then use the built-in function random first to generate a number between 0 and 6 (including). The expression (random) by itself generates a random integer. You can call it with one parameter to return a value within the range from 0 to the value of the parameter-1. For example, (random 10) will return a value between 0 and 9. Next, use the number generated at the previous step to retrieve the symbol for the day of the week from the list. Use the built-in elt. Extract the symbol-name of the day first, then apply the built-in function capitalize to it. Use the result in the princ function call, and do the same thing for the next day. Make the function return true (t) instead of the last thing it evaluates, to avoid seeing the message printed more than once.arrow_forward
- Calling a function with multiple arguments requires careful order.arrow_forwardWhen a function accepts several arguments, how important is it what order those arguments are sent in?arrow_forwardC++ assignment Write a C++ program that lets the user guess whether a randomly generated integer would be even or odd. The program randomly generates an inte- ger and divides it by 2. The integer is even if the remainder is 0, otherwise odd. The program prompts the user to enter a guess and reports whether the guess is correct or incorrect.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
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