please code this for me in c++ using void, functions, loops, (basic c++ not complicated or highlevel please). I tried to code it myself but there are many mistakes I dont know how to fix so please...


please code this for me in c++ using void, functions, loops, (basic c++ not complicated or highlevel please). I tried to code it myself but there are many mistakes I dont know how to fix so please write a similar one for me but it works.


The question is only 1 but it has 2 parts (2 different functions that should be in one code)






MY CODE:


#include
using namespace std;


int IsPalindrome(int p);
void GCD();


int main ()
{
    int choice;
    cout < "please="" enter="" a="" choice:=""><>
    cout < "enter="" one="" for="" ispalindrome=""><>
    cout < "enter="" 2="" for="" gcd=""><>
    cout < "enter="" 3="" to="" exit="" the="" program=""><>
    cout < "choice:=""><>
    cin >> choice;


    if (choice == 1)
    {
        int p;
        cout < "please="" enter="" a="" 3="" digit="" number:=""><>
        cin >> p;


if(p%10==p/100)
 {
  cout


 else
 {
  cout<>



    }

    else if (choice == 2)
    GCD();

    else if (choice == 3)
    exit (0);

    return 0;
}




void GCD()
{
    int GCD(int n, int d)
{
   if (n == 0)
      return d;

   if (d == 0)
      return n;
   if (n == d)
      return n;
   if (n > d)
     return GCD(n-d, d);
     return GCD(n, d-n);
}




int n,d;
cout<"enter the="" value="" of="" n="<cin>>n;
cout<<" enter="" the="" value="" of="" d="<cin>>d;
cout<<" gcd="" of=""><><" and=""><><" is="">


}


return 0;

}


a. Write a function called IsPalindrome that receives a 3-digit number and returns whether it is<br>palindrome or not.<br>b. Write a function, called GCD that receives two parameters n, d, and prints their greatest common<br>divisor<br>a. Now after you created the two functions, you have to write a main function that can call the<br>above functions according to user choice. Write a menu that allows the user to select from the<br>following options<br>1. To use the IsPalindrome function you have to enter 1.<br>2. To use the GCD function you have to enter 2.<br>3. To Exit the program you have to enter 3. [use exit(0)]<br>Once the user select one of the above choices you have to read the value entered by the user and<br>then to call the respective function.<br>

Extracted text: a. Write a function called IsPalindrome that receives a 3-digit number and returns whether it is palindrome or not. b. Write a function, called GCD that receives two parameters n, d, and prints their greatest common divisor a. Now after you created the two functions, you have to write a main function that can call the above functions according to user choice. Write a menu that allows the user to select from the following options 1. To use the IsPalindrome function you have to enter 1. 2. To use the GCD function you have to enter 2. 3. To Exit the program you have to enter 3. [use exit(0)] Once the user select one of the above choices you have to read the value entered by the user and then to call the respective function.
Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here