Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help on recursion problem for discrete structure. First year in c++ and discrete structure class. Can only take 3 functions only. And can only

Need help on recursion problem for discrete structure. First year in c++ and discrete structure class. Can only take 3 functions only. And can only use C++.
image text in transcribed
image text in transcribed
Lab 3:Recursion In this lab, yu implement the recursive algorithms you came up with in section 9.8. Program Specifications Each of these functions must be implemented recursively. If any function does not solve the task recursively, you will not get credit for this lab! 1. Write a recursive function to compute the sum of the cubes of the first n positive integers. For example, if n 4, your function should return 100 (1323343) 2. Write a recursive function takes as input two non-negative integers x and y and returns the product of x and y. The only arithmetic operations your algorithm can perform are addition or subtraction. Your algorithm should have no loops. 3. Write a recursive function that takes as input a non-negative integer n and returns a collection (array, vector, set, whatever you want) containing all binary strings of length n. Make sure every element in the collection is unique (sets will do this for you, and behave pretty much the same way as vectors do) http://www.cplusplus.com/reference/set/set/ Implement a menu to let the user choose which function to run. The program should loop until the user chooses to quit. Be sure to handle the case that the user inputs an invalid number as the menu choice. sample output given below Hints and Tips Submit a PDF containing a screen shot of your program running. Use the input from the . If yo u want to format your output, check out the iomanip header You may want to check out what methods are available for strings (http://www.cplusplus.com/reference, string, string/Tkw=string) Check list Your code must have a name header as described in the syllabus. Each of these items is worth two points of your grade. Your output must Have a titlein the output Include a short paragraph indicating the purpose of the application to the user and any directions the user needs. . Use complete and clear sentences - do not assume the user knows what you expect from him/her Have NO grammatical errors and/or spelling errors. Have NO typos this includes using capital letters at the beginning of a sentence and pune- tuation at the end of sentences

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

=+Can the readability be improved?

Answered: 1 week ago

Question

Am I providing feedback consistently?

Answered: 1 week ago