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.
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)
{
}