指针初学者 求批评,计算aaaaaaa-aaaaaa-aaaaa-aaaa-aaa-aa-a的值,也就是n个a减去n-1个a,a n自己输入#include #include void sum(int a,int n,double *p);void main(){ int a,n; double result; printf("Please input a and n:"); scanf("%d%d",&a,&n); sum(a,n,&result); printf("The result is %f!\n",result);}void sum(int a,int n,double *p){ long i,k; double result; p=&result; *p=a*pow(10,(n-1))+a; for(i=1;i

问题描述:

指针初学者 求批评,计算aaaaaaa-aaaaaa-aaaaa-aaaa-aaa-aa-a的值,也就是n个a减去n-1个a,a n自己输入
#include
#include
void sum(int a,int n,double *p);
void main()
{
int a,n;
double result;
printf("Please input a and n:");
scanf("%d%d",&a,&n);
sum(a,n,&result);
printf("The result is %f!\n",result);
}
void sum(int a,int n,double *p)
{
long i,k;
double result;
p=&result;
*p=a*pow(10,(n-1))+a;
for(i=1;i