Sunday, March 31, 2013

Character Pyramid

Character pyramid algoritm is generally based on its the ascii values of the characters.
The American Standard Code for Information Interchange (ASCII) is a  character-encoding  scheme originally based on the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text. Most modern character-encoding schemes are based on ASCII, though they support many additional characters.

Here is the complete ascii chart....

Program:
 
#include<iostream>
using namespace std;
int main()
{
    system("color 1e");
    int n,i,j;
    char ch;
    cout<<"\n\n\n";
    for(i=65;i<=69;++i)
    {
        cout<<"\t\t\t\t";
        for(j=65;j<=i;++j)
        {
            ch=j;
            cout<<ch;
        }
        cout<<endl;
    }
    cout<<"\n\n\n";
    return 0;
}
 
 
Output:
 
 

 

0 comments:

Post a Comment