On Dec 5, 2007 12:01 PM, eliakim_online25 <[EMAIL PROTECTED]> wrote:
> This program will be like a gotoxy function. So i run it in Visual C++
>  6.0 and when i input a value for nCol another textbox will appear
>  thats says "gotoxy.exe has encountered a problem and needs to close.
>  We are sorry for the inconvenience." then there will be options to
>  debug, send error report, don't send. But when i run it in DJGPP it
>  can input both values of nCol and nRow but there will be no ouput.
>  What is the problem of this program? thx for your help....
>  #include <stdio.h>
>  main()
>  {
>  int i,j;
>
>  int nCol,nRow;
>
>  nCol=0;
>  nRow=0;
>
>  printf("Enter a value for Col: ");
>  scanf("%d", nCol);
>  printf("Enter a value for Row: ");
>  scanf("%d", nRow);

You need to pass in the address if the variable for scanf, using the & operator:
 printf("Enter a value for Col: ");
 scanf("%d", &nCol);
 printf("Enter a value for Row: ");
 scanf("%d", &nRow);

Also, you need to use \n at the end of each string you pass to printf,
otherwise the output buffer might not get flushed and the user might
not see the output.
Another advice is to learn to indent your code, it's very hard to
analyze it when everything is in one column.

-- 
Tamas Marki

Reply via email to