ASCII Values
ASCII
- ASCII stands for American Standard Code for Information Interchange.
- It is a character encoding standard used for representing text and controlling characters on computers and other devices that use text.
- It was developed in the early 1960s and is based on the English alphabet.
- ASCII is a fundamental character encoding standard that has played a crucial role in the development of computing and text processing.
- ASCII values range from 0 to 127 and are divided into the following categories:
- Control characters (0-31 and 127): Used for control purposes, such as tabs, line breaks, and bell sounds.
- Uppercase letters (65–90): A–Z
- Lowercase letters (97-122): a-z
- Digits (48–57): 0–9
- Punctuation marks and special characters (32-47, 58-64, 91-96, 123-126): !, @, #, $, etc.
- ASCII values are used in computing and programming for various purposes, such as:
- Character representation
- String manipulation
- Data storage
- Encryption and decryption
Example:
#include <iostream>
using namespace std;
int main()
{
char ch = 98;
cout << ch <<endl;
return 0;
}
The output of the program will be:
b
Here’s a brief explanation of the code:
- The char ch = 98 statement declares a character variable ch and assigns it the ASCII value 98.
- The cout << ch << endl statement prints the character represented by the ASCII value 98, which is ‘b’, to the console.
- The return 0 statement indicates successful execution of the program.
Problem on ASCII
Convert a small letter (lower case) to a capital letter (upper case).