救急啊 C语言题
提示: 作者被禁止或删除 内容自动屏蔽
#include<stdio.h> #include<stdlib.h> void main() { int a,b; void calculate (int *psum,int *psub); printf("请输入a的值:a="); scanf("%d",&a); printf("请输入b的值:b="); scanf("%d",&b); calculate (&a,&b); system("pause"); } void calculate (int *psum,int *psub) { int a,b; int sum,sub; a=*psum; b=*psub; sum=a*a+b*b; sub=a*a-b*b; printf("a^2+b^2=%d\n",sum); printf("a^2-b^2=%d\n",sub); }
#include<stdio.h> #include<stdlib.h> void main() { int m,n; void calculate(int &psum,int &psub); printf("请输入a的值:a="); scanf("%d",&m); printf("请输入b的值:b="); scanf("%d",&n); calculate (m,n); system("pause"); } void calculate (int &psum,int &psub) { int a,b; int sum,sub; a=psum; b=psub; sum=a*a+b*b; sub=a*a-b*b; printf("a^2+b^2=%d\n",sum); printf("a^2-b^2=%d\n",sub); }