编程问题?高手进

来源:百度知道 编辑:UC知道 时间:2024/05/24 12:07:03
下面程序输入后不能执行,是否程序有错
请各位高手帮忙看下:
谢谢!!!!
#include<stdio.h)
void fun(int *a,int *b)
{ *a= * a+2;
*b= *a-*b;
printf("In subfun after calling\n");
printf("a=%-4d a*b=%-4d\n",*a,*b,*a* *b);
}
int main()
{ int a,b;
clrscr();
printf("\na,b=?\n");
scanf("%d%D",&a,&b);
printf("In fun before calling\n");
printf("a=%-4d b=%-4d a*b=%-4d\n",a,b,a*b);
fun(&a,&b);
printf("In fun after calling\n");
printf("a=%-4d b=%-4d a*b=%-4d\n",a,b,a*b);
getch();
return 0;
}

编译通过了
#include<stdio.h>
void fun(int *a,int *b)
{ *a= * a+2;
*b= *a-*b;
printf("In subfun after calling\n");
printf("a=%-4d a*b=%-4d\n",*a,*b,*a* *b);
}
int main()
{ int a,b;
//clrscr();
printf("\na,b=?\n");
scanf("%d%D",&a,&b);
printf("In fun before calling\n");
printf("a=%-4d b=%-4d a*b=%-4d\n",a,b,a*b);
fun(&a,&b);
printf("In fun after calling\n");
printf("a=%-4d b=%-4d a*b=%-4d\n",a,b,a*b);
//getch();
return 0;
}
clrscr(); 没定义呀

楼上的你该不会是在VC调试吧~~

理论上应该在TC下调试
我改了一下楼主的程序:
#include<stdio.h>
#include<conio.h>

void fun(int *a,int *b)
{ *a= * a+2;
*b= *a-*b;
printf("In subfun after calling\n");
printf("a=%-4d b=%-4d a*b=%-4d\n",*a,*b,*a* *b);