Printing ascii table...

Hi,

I want to print all ascii keys in AsCII table except first 31 keys which r non printable. I am using Turbo C++ 3.0. From following program I am able to print all characters values, but unable to print decimal value like 0 to 9 and other values like %, $ etc.

#include
#include
#include

int main()
{
char c = 'A';
clrscr();
printf("%d", c);
getch();
return 0;
}

Please help,

Thanks,

Usama.


Comments

  • : Hi,
    :
    : I want to print all ascii keys in AsCII table except first 31 keys which r non printable. I am using Turbo C++ 3.0. From following program I am able to print all characters values, but unable to print decimal value like 0 to 9 and other values like %, $ etc.
    :
    : #include
    : #include
    : #include
    :
    : int main()
    : {
    : char c = 'A';
    : clrscr();
    : printf("%d", c);
    : getch();
    : return 0;
    : }
    :
    : Please help,
    :
    : Thanks,
    :
    : Usama.
    :
    :
    :
    Why don't you try the following
    [code]
    #include
    void main()
    {
    int i=33;
    while(i<129)
    {
    if(i%10 == 0)
    printf("
    ");
    printf("%c ",i);
    i++;
    }
    printf("
    ");
    }
    [/code]

  • : Hi,
    :
    : I want to print all ascii keys in AsCII table except first 31 keys which r non printable. I am using Turbo C++ 3.0. From following program I am able to print all characters values, but unable to print decimal value like 0 to 9 and other values like %, $ etc.
    [code]
    : #include
    : #include
    :
    : int main()
    : {
    [red] int x;
    : clrscr();
    : for(x=33;x<256; x++)
    printf("%c ", x);
    [/red]
    : getch();
    : return 0;
    : }
    :
    : Please help,
    :
    : Thanks,
    :
    : Usama.
    :
    :
    :
    [/code]
    [green]
    How about that?
    [/green]

  • : : Hi,
    : :
    : : I want to print all ascii keys in AsCII table except first 31 keys which r non printable. I am using Turbo C++ 3.0. From following program I am able to print all characters values, but unable to print decimal value like 0 to 9 and other values like %, $ etc.
    : [code]
    : : #include
    : : #include
    : :
    : : int main()
    : : {
    : [red] int x;
    : : clrscr();
    : : for(x=33;x<256; x++)
    : printf("%c ", x);
    : [/red]
    : : getch();
    : : return 0;
    : : }
    : :
    : : Please help,
    : :
    : : Thanks,
    : :
    : : Usama.

    Thanks,
    This solved the problem.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories