//Jordan Steffen //Stej4019 //cs201-807 /* purpose user enter three digits and base ...determine if they are all valid if no stop program, if yes continue to run convert the base to base10 and display value */ #include using namespace std; bool isDigit(char c); int digit2Int(char c); bool isValid(int d2, int d1, int d0, int base); int base10(int d2, int d1, int d0, int base); int main() { //ask user for first digit char digit1; cout<<"Enter first Digit"; cin>>digit1; //ask user for second digit char digit2; cout<<"Enter second digit"; cin>>digit2; //ask user for third digit char digit3; cout<<"Enter third digit"; cin>>digit3; //ask user for integer base int base; cout<<"Enter integer base"; cin>>base; if (isDigit(digit1))//tests digit1 against isDigit function { cout<= 2 && base <=10) //tests to see if base is between 2 and 10 inclusive { cout<='0' && c <='9') { return true; } else { return false; } } //converts given char to int type for calculations at the time it's called int digit2Int(char c) { return (c-'0'); } //tests if base is strictly larger than the other three inputs bool isValid(int d2, int d1, int d0, int base) { if(base > d0 && base > d1 && base > d2) { return true; } else { return false; } } //return base 10 equivalent of number defined by: d2, d1, d0 and base int base10(int d2, int d1, int d0, int base) { return(d2 * base * base + d1 * base + d0); }