Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have been hired by an unnamed agency to devise a program which serves as a c

ID: 3555089 • Letter: Y

Question

You have been hired by an unnamed agency to devise a program which serves as a converter between ASCII codes and their associated character values (letters, digits, and symbols). ASCII stands for the American Standard Code for Information Interchange. Essentially, ASCII assigns a unique integer between 0 and 255 to each character value. To learn more about ASCII, please visit the site http://www.computerhope.com/jargon/a/ascii.htm
2.The program should do the following:
1.Create constants MIN_ASCII_VALUE, MAX_ASCII_VALUE, and MAX_EXTENDED_ASCII_VALUE with values 0, 127, and 255 respectively.
2.Display the heading "ASCII Code Breaker 1.0" on the screen.
3.Prompt the user for an ASCII code.
4.Get the input from the user.
5.Check to see if the user entered a value between MIN_ASCII_VALUE and MAX_EXTENDED_ASCII_VALUE. Continue to inform the user that the input entered was invalid by outputting the message "You entered an integer which is out of bounds." and prompt the user to enter another ASCII value until the value lies in the correct range.
6.Display a small 2x2 table with headings that depend on the ASCII code entered. If the code the user entered is between 0 and MAX_ASCII_VALUE, the headings should be "ASCII code" and "Character". Otherwise, the headings should be "Extended ASCII code" and "Character". However, You should format the cells so that they are left-aligned, the first column should have width 25 and the second column should have width 10. The cell under "ASCII code" (or "Extended ASCII code") should display the code the user entered. The cell under "Character" should display the character value that the ASCII code represents, To do this, you need to cast the int value the user entered into a value of type char using a static cast.
7.Prompt the user for a character value.
8.Store the response in a char variable.
9.Display a small 2x2 table with headings "ASCII code" and "Character". Again, the first column should have width 25 and the second column should have width 10. The cell under "ASCII code" should display the ASCII code representing the character value the user entered. To do this, you need to cast the char value the user entered into a value of type int using a static cast. The cell under "Character" should display the character value that the user entered

Explanation / Answer

please rate - thanks

the 2X2 table is just the output 2 rows, 2 colums

1 row is the heading, the 2nd row is the output

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{const int MIN_ASCII_VALUE=0;
const int MAX_ASCII_VALUE=127;
const int MAX_EXTENDED_ASCII_VALUE=255;
int code;
char value;
cout<<"ASCII Code Breaker 1.0 ";
cout<<"Enter an ASCII code: ";
cin>>code;
while(code<MIN_ASCII_VALUE||code>MAX_EXTENDED_ASCII_VALUE)
    {cout<<"You entered an integer which is out of bounds ";
     cout<<"Enter an ASCII code: ";
     cin>>code;
    }
cout<<endl;
if(code<=MAX_ASCII_VALUE)
    cout<<setw(25)<<left<<"ASCII code"<<setw(10)<<left<<"Character"<<endl;
else
    cout<<setw(25)<<left<<"Extended ASCII code"<<setw(10)<<left<<"Character"<<endl;
cout<<setw(25)<<left<<code<<setw(10)<<left<<static_cast <char>(code)<<endl;
cout<<endl;
cout<<"Enter a character value: ";
cin>>value;
cout<<endl;

cout<<setw(25)<<left<<"ASCII code"<<setw(10)<<left<<"Character"<<endl;
cout<<setw(25)<<left<<static_cast <int>(code)<<setw(10)<<left<<value<<endl;
cout<<endl;
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote