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

c++ Code... most basic c++ code you could come up with Characters for the ASCII

ID: 3849359 • Letter: C

Question

c++ Code... most basic c++ code you could come up with

Characters for the ASCII Codes
Write a program that uses a loop to display the characters for each ASCII code 32 through 127.Display 16 characters on each line with a space between one character and the next one.
Set up a function that receives a short integer (short int) and returns the corresponding ASCIIcharacter. The function must work returning an ASCII character regardless of the received value.HINT: ASCII codes go from 0 to 127.

*keep it as simple as possible*

*use two nested loops*

Explanation / Answer

#include <iostream>
using namespace std;

char getASCII( short input ){
   return (char)(input);
}

int main(){
   for(int i = 32; i <= 127; i+=16){
       for(int j= i; j<i + 16 ; j++){
           cout << getASCII(j) << " ";
       }
       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