ASCII Table

This is a discussion on ASCII Table within the C Programming forums, part of the General Programming Boards category; yeah i need from 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D etc across ...

  1. #16
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    yeah i need from 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D etc across and again down. then everything lines up so it looks like a table.

  2. #17
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    peckitt99: You've been given enough help to make your initial attempt. Start posting your own code or you will be perceived as a leech. And demonstrate your interest in a helpful answer by posting your attempt in code tags.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #18
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    ok sorry, im just new to all of this.

  4. #19
    Registered User
    Join Date
    Jul 2006
    Posts
    111
    Why not use type casting within a loop, quite simple really.

  5. #20
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You don't need a typecast.


    Quzah.
    Hope is the first step on the road to disappointment.

  6. #21
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    i have finally got the table using gotoxy but i am now having troubles getting the ascii inside the table. because at the moment i have to row and coloum and then the ascii is underneith. this is the code i have so far

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <conio.h>
    
    int main ()
    {
    
       unsigned int ch; //ch is the unsigned integer
       int line;
    
    gotoxy (3,1);
    cprintf("00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
    gotoxy(1,3);
    
    for (line=0x0; line <0x0F; line++)
    cprintf("%x\r\n",line);
    
    
       for ( ch = 0x00; ch < 0xFF; ch++ )// to output all the charactures.
       {
          cprintf(" %c  ",  ch);//print all the characters from ch
          if ( !(ch % 16 ) )
          putchar('\n');
       }
    
    
     printf ("\n\n\n");
    system("pause");
    }

  7. #22
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    What is gotoxy() for? Other than making your code non-portable, of course. Just print the header on the first line, then print the characters on subsequent lines, making sure they line up. Drop <conio.h>, it's non-standard. And system("pause") is not too good either.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing array, to file
    By zootreeves in forum C Programming
    Replies: 9
    Last Post: 09-08-2007, 05:06 PM
  2. Replies: 11
    Last Post: 03-24-2006, 10:26 AM
  3. help! extended ascii table
    By godhand in forum Linux Programming
    Replies: 7
    Last Post: 10-07-2003, 05:20 PM
  4. ASCII table going crazy?
    By Jamsan in forum Windows Programming
    Replies: 19
    Last Post: 03-27-2003, 01:33 AM
  5. Printing characters not in the ASCII table
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 01-21-2002, 12:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21