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.
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.
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.*
ok sorry, im just new to all of this.
Why not use type casting within a loop, quite simple really.
You don't need a typecast.
Quzah.
Hope is the first step on the road to disappointment.
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"); }
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;}