//Saliha Babar CS1A Chapter 5, Page 294, #2
//
/************************************************************************
*
* CHARACTERS OF ASCII CODES
* ______________________________________________________________________
* This program displays characters for the ASCII codes 0 through 127
* in 16 characters in each lines.
*
* there is no specific formula related to this program
* ______________________________________________________________________
* INPUT
* no specific input
*
* OUTPUT
* ASCII characters from 0 - 127 in 16 characters in each lines
*
* *********************************************************************/
#include <iostream>
using namespace std;
int main() {
int count; // Counter variable
char character; // OUTPUT - character represented by ASCII value
for (count = 0 ; count <= 127 ; count++)
{
// Type Casting
character = static_cast<char>(count);
cout << character ;
// Format the output
if ((count + 1) % 16 == 0)
{
cout << endl;
}
else
{
cout << ' ';
}
}
return 0;
}
Ly9TYWxpaGEgQmFiYXIgICAgICAgICAgICAgICAgQ1MxQSAgICAgICAgICAgICAgIENoYXB0ZXIgNSwgUGFnZSAyOTQsICMyCi8vCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICogCiAqIENIQVJBQ1RFUlMgT0YgQVNDSUkgQ09ERVMKICogX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwogKiBUaGlzIHByb2dyYW0gZGlzcGxheXMgY2hhcmFjdGVycyBmb3IgdGhlIEFTQ0lJIGNvZGVzIDAgdGhyb3VnaCAxMjcKICogaW4gMTYgY2hhcmFjdGVycyBpbiBlYWNoIGxpbmVzLgogKiAKICogdGhlcmUgaXMgbm8gc3BlY2lmaWMgZm9ybXVsYSByZWxhdGVkIHRvIHRoaXMgcHJvZ3JhbSAKICogX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwogKiBJTlBVVCAKICogICAgbm8gc3BlY2lmaWMgaW5wdXQKICogCiAqIE9VVFBVVAogKiAgICBBU0NJSSBjaGFyYWN0ZXJzIGZyb20gMCAtIDEyNyBp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