Sunday, August 2, 2009

Please help! I write the C program and try to run ,but how can i keep the program display on the monitor?

/*this is my code, please someone help me to keep this program display on window.*/





#include %26lt;stdio.h%26gt;


#define MAX_SIZE 10














int main ()


{





int i, ary[10];


/*int* pWalk;


int* pEnd; */





/*for (i = 0; i %26lt; 10; i++)*/





printf ("Enter your numbers: \n");


for ( i = 0; i %26lt; 10; i++)


scanf( "%d", %26amp;ary[i]);





printf ("Your reversed numbers are: \n");


for ( i = 10 -1; i %26gt;=0; i--)


{





printf ("%d\n ", %26amp;ary[i]);


if ( i %26lt; 9)


i++;


else


{


printf("\n");


i = 0;


}


}


return 0;





}

Please help! I write the C program and try to run ,but how can i keep the program display on the monitor?
If you are using Visual C++, you click "Start Without Debugging" like this:





http://xoax.net/comp/cpp/console/Lesson1...
Reply:I way I solved that problem is to wait for a user input:





This is C++ code. You can figure out how to do it in C:





cout%26lt;%26lt; " Press any key and %26lt;enter%26gt; to quit: ";


char key;


cin%26gt;%26gt; key;





So, you end up waiting for user input.

thank you cards

No comments:

Post a Comment