Question: C++ Programming. Ch.7 The purpose of the assignment is to practice writing methods that are recursive. We will write four methods each is worth 15
C++ Programming. Ch.7 The purpose of the assignment is to practice writing methods that are recursive. We will write four methods each is worth 15 points. a- int sum_sqr_rec(stack stk) which will receive a stack of "int" and output the sum of the squares of the elements in the stack. b- int plus_minus_rec(stack stk) which will receive a stack of "int" (example: {a,b,c,d,e,f,g,h,i,j}) and output the sum of the elements in the stack as follows: a - b + c - d + e - f + g - h + i -j c- void prt_chars_rev_rec(stack stk) which will receive a stack of "char" and print its elements in reverse. d- void prt_chars_rec(queue que) which will receive a queue of "char" and print its elements. Remember to use the stack and queue STL. The Assignment will require you to create 2 files: 1- Recursive.h which contain the details of creating the 4 methods as specified above: int sum_sqr_rec(stack stk), (15 points) int plus_minus_rec(stack stk), (15 points) void prt_chars_rev_rec(stack stk), (15 points) void prt_chars_rec(queue que), (15 points) 2- RecursiveDemo.cpp which: A- reads a string expression: {(1+2)+[4*(2+3)]} and store the expression in a stack and a queue.(15 points) a- prints the corresponding expression in reverse using: prt_chars_rev_rec ( 5 points): }])3+2(*4[+)2+1({ b- prints the corresponding expressing as is using: prt_chars_rec.( 5 points): {(1+2)+[4*(2+3)]} B- reads an array of integers: 1 2 3 4 5 6 7 8 9 10 and store them in a stack of ints.(5 points) Then it: c- prints the sum of the squares of the elements in the stack using int sum_sqr_rec(stack stk) and outputting the value(5 points): 385 d- prints the sum of the elements in the stack using: int plus_minus_rec(stack stk) and outputting the value(5 points): 1 - 2 + 3 - 4 + 5 - 6 + 7 - 8 + 9 - 10 = -5 Do not forget to drop the 2 files in the dropbox of Assignment7.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
