C++ By using a function and only use #include (other library and ANY LOOP(for, while) are not allowed) , please use recursion to write the code. input any math formula in string, the input and return result should be like this below: Case 1 input: "1+1-2+1334" return: "1334" Case 2 input "16+41-53+8768" return: "8772" Case 3 input "5563-4326+3-8+45" return: "1277" Case 4 input "4+3" return: "7" given function: int calculate(const char str[]) You can add more function to help if needed.(ANY LOOP(for, while) are also not allowed)

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.1: Function And Parameter Declarations
Problem 11E
icon
Related questions
Question

C++

By using a function and only use #include (other library and ANY LOOP(for, while) are not allowed) , please use recursion to write the code.

input any math formula in string, the input and return result should be like this below:

Case 1 input: "1+1-2+1334" return: "1334"

Case 2 input "16+41-53+8768" return: "8772"

Case 3 input "5563-4326+3-8+45" return: "1277"

Case 4 input "4+3" return: "7"

given function: int calculate(const char str[])

You can add more function to help if needed.(ANY LOOP(for, while) are also not allowed)

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Declaring and Defining the Function
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr