ASCII – ASCII table
1. What is the ASCII code?
ACSI (American Standard Code for Information Interchange – Ascii information USA), often pronounced ace-fiber-ki, the character and the character code based on the Latin alphabet used in modern English and other Western European languages. It is often used to display text in computers and other information devices. It is also used by the control device working with text. (theo wiki).
Thus each one character we will have a corresponding identification number as the table below.
In which you pay attention to some special code:
- 65 A
- 97 is a
- 48 is number 0
2. Code ASCII code generation
The program is written in C ++ by Dev-nguyenvanquan7826.
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <windows.h> void gotoxy(int x, int y) // xay dung ham gotoxy { static HANDLE h = NULL; if(!h) h = GetStdHandle(STD_OUTPUT_HANDLE); COORD c = { x, y }; SetConsoleCursorPosition(h,c); } void SetColor(WORD color) { HANDLE hConsoleOutput; hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info; GetConsoleScreenBufferInfo(hConsoleOutput, &screen_buffer_info); WORD wAttributes = screen_buffer_info.wAttributes; color &= 0x000f; wAttributes &= 0xfff0; wAttributes |= color; SetConsoleTextAttribute(hConsoleOutput, wAttributes); } int main(){ int a[256] = {0}; a[7] = a[8] = a[9] = a[10] = a[13] = 1; char *s = "ASCII table upload by nguyenvanquan7826"; gotoxy(40 - strlen(s)/2, 1); printf("%s\n\n", s); system("color 1A"); // Dat mau, mau nen la 1, mau chu la A for (int i=0; i<20; i++){ for (int j=i, k = 0; k<13 && j<256; k++, j += 20){ //SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 5); SetColor(10); printf("%4d ", j); SetColor(15); if (a[j]) printf(" "); else printf("%c", j); } printf("\n"); } SetColor(10); s = "Program in Dev-C++"; gotoxy(40 - strlen(s)/2, 24); printf("%s\n\n", s); }
s Kids cuong copy tren ban ASCII ve ma vegetarian whip. la king no vegetarian velvet mat finish tieu ak..e getch job added and return on thi bi loi…?
Dev-C alone use, it can stop the screen you ah.
If it does not stop, you add the following statement at the end of the main function.
Thanks a…
Vegetarian Star ticks collected e copy but not running, it keeps people in line fault: for (int i=0; in<20; i ){ What happened is a??
You save the file as * .cpp offline
My e print a copy machine ascii encoding it back out of the question-mark character is Star game
[img]http://i.imgur.com/1NOovFq.jpg[/img]
This is clearly not his. !!!!
e want to write the first letter of the table ascii:
when you cout<<tank(3);
it does not print that character sir
you can use printf(“%c”, 3); Print character code is 3 nhé.