c++ Convert decimal into other bases

Hello, I am learning and creating a C++ code that converts decimal into other bases.

Here is a code I found in internet search just the basic entering of numbers and validation, but it is not working for me.

Code:
int getbases (int base, int choice);
int convert (int base, int choice, int newbase);

int main() {
    int base, choice, newbase;
    
    getbases ( base, choice);
    convert (base, choice, newbase);
    
    system ("pause");
    return 0;
}

int getbases (int base, int choice)
    {
    cout <<" Please Enter a base of 2, 4, or 8 please." << endl;
    cin >> choice;  
    
         //Checking base input 2,4,8
        while(((choice < 2) || (choice > 2)) && ((choice < 4) || (choice > 4))
                   && ((choice < 8 || choice > 8)))
         {
            cout <<" Please Enter a base of ONLY 2, 4, or 8 please." << endl;
            cin >> choice; // closing while
            }
                
    cout << " Please Enter any decimal number:" << endl;
    cin >> base;
         while (base <= 0)
          {
             cout <<"Please enter a decimal greater then Zero" << endl;
             cin >> base;  
            } // closing while            
    return base, choice;  
    }
int convert (int base, int choice, int newbase)
{
    
}
I am providing a simple program that uses a switch statement for converting a decimal number to base 2 - binary, base 8 - octal and base 16 - hexadecimal numbers.

Code:
#include<iostream.h>
#include<conio.h>
void main()
{
int a[20],n,i=0,k,ch,rem,j,q,temp,bi,o,h;
char b[20];
clrscr();
cout<<"Enter a decimal number\n";
cin>>n;
for(k=0;k<3;k++)
{
cout<<("\n Enter the choice u want to do:\n 1. Decimal to Binary\n 2. Decimal to octal\n 3. Decimal to Hexadecimal\n");
cin>>ch;
switch(ch)
{
case 1:
    bi=n;
    while(bi!=0)
    {
        a[i++]=bi%2;
        bi=bi/2;
    }
    cout<<"\nBinary number is :";
    for(j=i-1;j>=0;j--)
    {
        cout<<a[j];
    }
    break;
case 2:
        o=n;
        i=0;
        while(o!=0)
    {
        a[i++]=o%8;
        o=o/8;
    }
    cout<<"\nOctal number is :";
    for(j=i-1;j>=0;j--)
    {
        cout<<a[j];
    }
    break;
case 3:

        q=n;
        i=0;
        while(q!=0)
    {
        temp=q%16;
        if(temp<10)
         temp=temp+48;
        else
         temp=temp+55;
        b[i++]=temp;
        q=q/16;
    }
    cout<<"\nHexadecimal number is :";
    for(j=i-1;j>=0;j--)
    {
        cout<<b[j];
    }
    break;
default:
cout<<"Invalid entry";

}
}
getch();
}
Thanks Suvarna for sharing this, @Madhan, did that help you?