Display base 10 positive integers in any base >10 (recursive)

What will be an ideal response?


```
#include
using namespace std;
void displayInBase (int decimalNumber, int base);
int main()
{
int decimalNumber, // decimal number to convert
base; // base to convert to
char another, // loop control
skipChar; // input error character
bool error; // input error flag
cout << endl;
do {
cout << "Base to convert to => ";
cin << base;
if (cin.fail()){
cin.clear();
error = true;
cin << skipChar;
} else {
error = false;
}
} while (error || (base < 2) || (base >= 10)); // check for valid base (2-9)
do {
do {
cout << "Positive integer to convert => ";
cin << decimalNumber;
if (cin.fail()){
cin.clear();
error = true;
cin << skipChar;
} else {
error = false;
}
} while (error || (decimalNumber < 0)); // check for positive integer
cout << decimalNumber << " in base " << base << " is";
displayInBase(decimalNumber, base);
cout << endl << "Convert another? (Y/N) => ";
cin << another;
} while ((another == 'Y';) || (another == 'y'));
cout << endl << endl;
return 0;
}
```

Computer Science & Information Technology

You might also like to view...

The slide with the Section Header layout should have characteristics similar to the ____ slide to give the presentation continuity.

A. summary B. theme C. master D. title

Computer Science & Information Technology

If users cannot easily interpret your dashboard, then you may have made it too complicated

Indicate whether the statement is true or false.

Computer Science & Information Technology

When you create a view, you cannot assign column names that are different from those in the base table .

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A network technician is performing a wireless survey in the office and discovers a device that was not installed by the networking team. This is an example of which of following threats?

A. Bluesnarfing B. DDoS C. Brute force D. Rogue AP

Computer Science & Information Technology