本帖最后由 董月峰 于 2014-3-24 14:46 编辑
/*
6、 输入两个数,打印(printf)这两个数的和、差、积、商、以及余数。(C语言编程题)
*/
#include<stdio.h>
int count(int num1, int num2, int *num3, int *num4, double *num5, int *num6)
{
if(num1 - num2 > 0)
*num3= num1 - num2;
else
*num3= num2 - num1;
*num4= num2 * num1;
*num5= (num1 * 1.0) / num2;
*num6= num2 % num1;
return(num1 + num2);
}
int main()
{
int a,b;
printf("请输入2个整数(中间用逗号隔开):\n");
scanf("%d,%d",&a,&b);
int add, minus, multiply, remainder;
double divide;
add= count(int num1, int num2, &minus, &multiply, ÷, &remainder);//这行报错了【expected expression这个错误】,求证
printf("2个数的和是%d,差是%d,积是%d,商是%f,余数是%d\n",add, minus, multiply, divide, remainder);
return 0;
}
|
|