Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions