does anyone know the metroworks codewarrior equivalent for getch(); and clrscr();
I'm doing an school assignment and the prob is that it has to compile using the school's out of date software. AND on a mac.
does anyone know the metroworks codewarrior equivalent for getch(); and clrscr();
I'm doing an school assignment and the prob is that it has to compile using the school's out of date software. AND on a mac.
Google turned this up, might be helpful.
No No's:
fflush (stdin); gets (); void main ();
Goodies:
Example of fgets (); The FAQ, C/C++ Reference
My Gear:
OS - Windows XP
IDE - MS Visual C++ 2008 Express Edition
ASCII stupid question, get a stupid ANSI
I'm sorry man but that dosen't help
Is clearing the screen and waiting for any keypress really a requirement? clrscr and getch are very out of date and the former is used by annoying programs. Have you looked for solutions in the FAQ?
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.*
Originally Posted by Whizza
For clrscr you could alawys get the dimensions of the screen, and have a function which runs on a for-loop which would press return according to the number of rows there ... there is always this .... I recommend number 5 (for clearing screen)
for getch(), you may be able to use some variation of kbhit(), but that's in conio too, I think, so it probably won't be any good for you
Damn I thought there might have been a quick compisate function
You could create your own one ... but I don't know of any other getch();, or system("pause"); functions ... somebody else may ... you could make your own one ... my making a HUGE array of GetAsyncKeyState(); or whatever it's called ... search through here for examples, and try MSDN.
Never mind according to this link,
http://www.freescale.com/files/soft_...ual/MSLCRM.pdf ,
there is a conjagate function for conio.h on macs, its called console.h
it does both clrscr and getch
now all I gotta do is test it
Thanks for the help!!!
You could also try this
cin.get();
It is used with iostream
-pete
cin::get() waits for the return key. getch() does not.
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;}