Hey, everyone that can help I appreciate it.
Every program I write no matter how simple the
Console box when you printf only stays on my monitor
for a second no matter what I do what can I do to make it stop
so I can see it for more than 1 second?
Hey, everyone that can help I appreciate it.
Every program I write no matter how simple the
Console box when you printf only stays on my monitor
for a second no matter what I do what can I do to make it stop
so I can see it for more than 1 second?
go here, there's the programming FAQ that's very helpful
http://faq.cprogramming.com/cgi-bin/...&id=1043284385
and try here
http://faq.cprogramming.com/cgi-bin/...&id=1043284385
and then of course tutorials
Last edited by linucksrox; 05-01-2006 at 11:02 PM.
"What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)
enter cin.get or getch() before return zero to wait a key press, this pauses the output so you can see the results of the program. But look at the FAQ board first mind - pete
at the end of the main function.Code:system("PAUSE"); return EXIT_SUCCESS;
On second though, no. Don't do this. Use cin.get() and keep your code standard like the rest of the world.Originally Posted by sasuke12
Sent from my iPadŽ
Ah, that wordstandard
The point is, command-line apps are (and should very well be) built to run exactly like command-line apps, including the immdiate termination! So there isn't some built-in magic wand to pause your program.
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;}