#include using namespace std; char IntToTrinaryDigit(int digit); int TrinaryToIntDigit(char digit); int main() { char letter; int i; int value; for (letter = 'a'; letter <= 'z'; ++letter) { cout << "The letter " << letter << " is " << letter-'a' << " from a" << endl; } cout << endl << endl; for (i =0; i < 26; ++i) { cout << "The letter " << i << " characters from a is " << static_cast('a'+i) << endl; } cout << endl << endl; for (letter = '0'; letter <= '9'; ++letter) { cout << "The character " << letter << " has an ascii value of " << static_cast(letter) << " and a numeric value of " << static_cast(letter -'0') << endl; } cout << endl; cout << "Testing trinary conversions " << endl; for (i = -1; i < 4; ++i) { letter = IntToTrinaryDigit(i); value = TrinaryToIntDigit(letter); cout << i << " converts to '" << letter << "' and back to " << value << endl; } return 0; } char IntToTrinaryDigit(int digit){ char value{' '}; if (digit >= 0 and digit < 3) { value = static_cast('0' + digit); } return value; } int TrinaryToIntDigit(char digit){ int value{-1}; if (digit >= '0' and digit < '3') { value = static_cast(digit - '0'); } return value; }