Code Competitions

Coding competition

Friday, 31 May 2013

program to create ascii 7 and ascii 8 conversions

#include<iostream.h>
#include<conio.h>
#include<process.h>
void menu(void);
void asci8(void);
void asci7(void);
void main()
{
    menu();
    getch();
}
void menu()
{
    int ch,i,c,l;
    clrscr();
    cout<<"1. asci7";
    cout<<"\n2. asci8";
    cout<<"\n3. exit";
    cout<<"\nenter your choice";
    cin>>ch;
    switch(ch)
    {
        case 1:
        asci7();
        break;
        case 2:
        asci8();
        break;
        case 3:
        exit(0);
    }
}
void asci7(void)
{
    int i,c=0,l=0;
    for(i=0;i<128;i++)
    {
        if (i != 26)
        cout<<i<<"  "<<(char) i<<"\t";
        c=c+1;
        if(c>6)
        {
            cout<<"\n";
            l++;
            if(l>20)
            {
                getch();
                clrscr();
                l=0;
            }
            c=0;
        }
    }
}
void asci8()
{
    int i,c=0,l=0;
    for(i=0;i<256;i++)
    {
        if(i!=26)
        cout<<i<<"  "<<(char) i<<"\t";
        c=c+1;
        if(c>6)
        {
            cout<<"\n";
            l++;
            if(l>20)
            {
                getch();
                clrscr();
                l=0;
            }
            c=0;
        }
    }
}

No comments:

Post a Comment