Question: C++ Exercise 3 - Exploring the char data type with functions Print out the ASCII table. Refer to it for this problem. 1* Run code

C++

Exercise 3 - Exploring the char data type with functions Print out the ASCII table. Refer to it for this problem. 1* Run code with different character: a, A, x, 1, #, $. What results do you get ? Check with ASCII table. 2* Explain why the code/decode works ? Hint: What really is a char data type. // Code and Decode a character #include using namespace std; char CodeLetter(char c); // prototype for function code below int main char DecodeLetter(char c); // prototype for function code below int main int main () { char codedLetter; char decodedLetter; char letter = 'a'; // change me to a different character. cout << "Letter = " << letter << endl; codedLetter = CodeLetter(letter); cout << "Coded Letter = " << codedLetter << endl; decodedLetter= DecodeLetter(codedLetter); cout << "Decoded Letter = " << decodedLetter << endl; system ("pause"); return 0; } char CodeLetter(char c) { return c + 1;} // clue .. you can add 1 to a char char DecodeLetter(char c) { return c - 1;} // clue .. you can subtract 1 from a char Use filename: Week14YourNameProg3ASCIIFun

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!