2个回答
展开全部
#include <stdio.h>
#include<malloc.h>
int fun(int a, int b) {
int va = a - b;
return (va < 0) ? (-va):va;
}
int max_value(int arr[][4]) {
int i,j,max = arr[0][0];
for(i = 0; i < 2; i++) {
for(j = 0; j < 4; j++) {
if(max < arr[i][j])
max = arr[i][j];
}
}
return max;
}
/******10.78******/
struct Student
{
char name[20];
float mid_math;
float end_math;
};
int main(int argc, char *argv[])
{
int a = 1, b = -5,c;
c = fun(a,b);
printf("%d\n",c);
int arr[][4] = {{1,2,3,4},
{5,16,7,8}};
int max = max_value(arr);
printf("%d\n",max);
/******10.78******/
struct Student *stu = (struct Student*)malloc(sizeof(struct Student)*1);
stu->mid_math = 0.0;
stu->end_math = 0.0;
printf("input name:");
scanf("%s",stu->name);
printf("input mid_math:");
scanf("%f",&stu->mid_math);
printf("input end_math:");
scanf("%f",&stu->end_math);
float avg = (stu->mid_math + stu->end_math)/2;
printf("avg is: %.2f\n",avg);
free(stu);
return 0;
}
2015-03-31
展开全部
财富值太少 不爱给你写。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询