Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 096bba0

Browse files
Create ASCII example 11
Print ASCII characters with their values.
1 parent c62960a commit 096bba0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎ASCII example 11‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*Version: 17.9.2 C++17*/
2+
3+
// ASCII Printable characters
4+
/*A = 65 --> Z = 90 || a = 97 --> z = 122*/
5+
6+
int sn{}, en{};
7+
std::cout << "\n\nPrint ASCII character with their values.\n";
8+
std::cout << "---------------------------------------------\n";
9+
10+
std::cout << "\nInput the starting value for ASCII characters:\n";
11+
std::cin >> sn;
12+
13+
std::cout << "\nInput the ending value for ASCII characters:\n";
14+
std::cin >> en;
15+
16+
if (sn > 255 || sn < 0)
17+
{
18+
sn = 1;
19+
}
20+
if (en < 0 || en > 255)
21+
{
22+
en = 255;
23+
}
24+
25+
std::cout << "The ASCII characters: " << std::endl;
26+
for (int i = sn; i <= en; ++i)
27+
{
28+
std::cout << i << " --> " << char(i) << '\n';
29+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /