Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ simple programming A(0)=0 B(0)=0 Problem A: Alpha Beta Numbers (20 points) Assume Alpha numbers are defined by the following formula: A(x) = A(x -

C++ simple programming

A(0)=0

B(0)=0

image text in transcribed

image text in transcribed

Problem A: Alpha Beta Numbers (20 points) Assume "Alpha numbers" are defined by the following formula: A(x) = A(x - 1) + B(x) +1 Assume "Beta numbers are defined by the following formula: B(x) = B([2/2]) + A([2/2]) + x Note: inside the function are the "floor" operation, which round numbers down, so floor(5/2) 2. Assume that A(0) = 0, and B(0) = 0. Write a recursive C++ program that lets you enter a number, then finds both the Alpha and Beta number for that value. Special preparation rules. Recursion is aggressively required. To be very clear. When we ask for a recursive function, we are not joking. This is not a suggestion. Therefore, using any one of the following words anywhere in your program (even in comments) will lead to a grade of 0 in the autograder: for while goto Any one of these words could be used to make a loop, and you are not allowed to use even 1 loop anywhere in your submission. Hints A major trick here is that this is not a "simple" recursion (since alpha and beta both rely on alpha and beta). Just like any other recursive programming task, my first hint is "try not to overthink this" There is a way to declare functions before you define them, doing this allows you to call a function before you have coded the function (but after you've declared it). You will need to understand this concept and syntax to complete this program. Example 1 (user input is underlined for clarity, underlined text in your program is not needed). Further note that PDFs will sometimes use 2 spaces where our code only uses 1. (In general I do not recommend copy/pasting from PDFS) Which number? 1 Alpha number: 2 Beta number: 1 Example 2 (user input is underlined for clarity, underlined text in your program is not needed). Further note that PDFs will sometimes use 2 spaces where our code only uses 1. (In general I do not recommend copy/pasting from PDFS) Which number? 5 Alpha number: 52 Beta number: 18 Submission When you are done, name the source code file hw7A.cpp. Then log into gradescope and upload your file for the "Homework 7A submission. If you name your file incorrectly it will be unable to compile and run your code, so you will fail all test cases. You may submit cpp files as many times as you want until the deadline to try and fix the code if you fail a test case. Following rigorous naming conventions and using test cases are something computer programmers often must do in "real life" programming, and so submitting yo program with the correct name and functionality is part of doing this assignment correctly

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

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions