Question

that has user loop. The Design a computer program a executes the program, should do the following. computer, as it 1) The computer should politely ask the user for two input integers m and n. There should be code to make sure that m <-n 2) Then there should be a recursive function, called LargestToSmallestO that is invoked to output all the values from n downto m. 3) Then there should also be a recursive function, called SmallestToLargestO that is invoked to output all the values from m to n. 4 Then there should also be a recursive function, called OutputO that and n - 5, then the output would be 33 333

Recursion program

C++. Visual Studio Win 32 console application

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
using namespace std;

void LargestToSmallest(int m,int n)
{
if(n!=0)
{
cout<<m<<"\t";

LargestToSmallest(m,n-1);

}
else
{

}
}

int main()
{
int m,n;
cout<<"Enter two integers : "<<endl;
cin>>m>>n;
if(m<=n)
{
LargestToSmallest(m,n);
}
else
{
while(1)
{
cout<<"Please enter value of m which is less than or equal to n \nAgain Enter two integers "<<endl;
cin>>m>>n;
if(m<=n)
{
LargestToSmallest(m,n);
break;
}
}
}
cout<<endl<<endl;
system("pause");
return 0;
}

Add a comment
Know the answer?
Add Answer to:
Recursion program C++. Visual Studio Win 32 console application that has user loop. The Design a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • answer the following using C# Design and program a Visual Studio Console project in C# that...

    answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...

  • use C++ to write the following program. needs to ask the user for n The user...

    use C++ to write the following program. needs to ask the user for n The user must put in those 5 values, probably using a for loop. NOTE: You can assume the number of values to be entered is 5. My attempted program below: (not correct, but just a basis) 4. Larger Than n In a program, write a function that accepts three arguments: an array, the size of the array, and a number n. Assume that the array contains...

  • C# .netframework console application

    Design an Inventory class that stores the following members:serialNum An integer that holds a part’s serial number.manufactDate A member that holds the date the part was manufactured.lotNum An integer that holds the part’s lot number.The class should have appropriate member functions for storing data into and retrieving data from these members.Next, design a stack class that can hold objects of the class described above.Last, design a program that uses the stack class described above. The program should have a loop...

  • Write a complete C++ program to ask the user to enter 4 integers. The program must...

    Write a complete C++ program to ask the user to enter 4 integers. The program must use a function to find the smallest integer among them and print it on the screen. Typical output screen should be as following: Write a complete C++ program to ask the user to enter 4 integers. The program must use a functionto find the smallest integer among them and print it on the screen. Typical output screen should be as following: Note: the code...

  • Write a C++ program that asks the user to enter a single number from 1 to...

    Write a C++ program that asks the user to enter a single number from 1 to 50 and a choice of "even" or "odd". Using a recursive function, output the sum of all the even or odd integers from 1 up to (and including) that number. Your program does not need to loop and accept more input (only one input of the number then even/odd).

  • d printAllIntegers () Write a C++ program that defines and tests a function largest(....) that takes...

    d printAllIntegers () Write a C++ program that defines and tests a function largest(....) that takes as parame- ters any three integers and returns the largest of the three integers. Your output should have the same format and should work for any integers a user enters Desired output: Enter three integers: 6 15 8 The largest integer is: 15 7.3 Recursive Functions Write a program that uses a function sum(int) that takes as an argument a positive integer n and...

  • Write a complete C++ program to ask the user to enter 4 integers. The program must...

    Write a complete C++ program to ask the user to enter 4 integers. The program must use a function to find the LARGEST integer among them and print it on the screen. Typical output screen should be as following: Note: the code must contain function to find the LARGEST number. Enter four integers 1 2 4 0 Largest integer is 4

  • No. 7 7th question i want this code to be done on c++ visual studio without...

    No. 7 7th question i want this code to be done on c++ visual studio without using bool operation. and please try to make as simple as possible. Also i need flowchart for the code thanks. Q7 I need a code programmed on c++ visual studios. Also flowchart of the code. Try to make it simple college level understandable code. thanks. b. wg. Prompt the user to input the value of a double variabler, which stores the radius of a...

  • Write a complete C++ program to ask the user to enter 4 integers. The program must...

    Write a complete C++ program to ask the user to enter 4 integers. The program must use a function to find the largest integer among them and print it on the screen. Typical output screen should be as following: Note: the code must contain function to find the largest number. Enter four integers 1 2 4 0 Largest integer is 4 03 (35 points)

  • Write a complete C++ program that will: Declare a vector of integers Use a pointer to...

    Write a complete C++ program that will: Declare a vector of integers Use a pointer to dynamically allocate an array of 10 elements Ask the user how many values they would like to have in the data structures Read in the user’s response and make sure that it is greater than 20 (error loop) Generate the number of integers that the user asked for and store them into both data structures. The integer values should be unique unordered values (no...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT