Showing posts with label ASCII. Show all posts
Showing posts with label ASCII. Show all posts

C / C++ Program to Print All The ASCII Character & Their Equivalent Integer Value

1 comment
/* The following program will run from 0 to 255, which is the overall range of the Character set. Likewise the program will print the number & the corresponding ASCII character. The 2nd for loop is for formatting the print pattern & the 1st one is for printing the ASCII character & the corresponding integer number. */

//CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k=0,l=0;
printf("\n");
for(i=0;i<=255;i++)
{
printf("%5d%2c",k,k);
k++;
l++;
if(l==11)
{
    l=0;
for(j=1;j<=2;j++)
printf("\n");
}
}
getch();
}


Screenshot:
C / C++ Program to Print All The ASCII Character & Their Equivalent Integer Value
C / C++ Program to Print All The ASCII Character & Their Equivalent Integer Value

Read More...

C++ Program To Print The Corresponding ASCII values Of English Alphabets

Leave a Comment
/*A simple C++ program to display ASCII values of English Alphabets. You can extend this program to show all ASCII values and their corresponding characters by modifying for loop for(i=0;i<=255;i++) & removing if and continue statements from line no 9 and 10 respectively.*/

#include<stdio.h>
#include<conio.h>                 //For console input/output function 
void main()
{
int i;
for(i=65;i<=122;i++)            
//ASCII value of alphabets ranges from 65 to 122 {
if (i >=91 && i <= 96)          
//to avoid non alpha characters
continue;
printf("%d - %c", i, i);
printf("\t");
}
getche();
}
Read More...