摘要: #include<stdio.h>#define N 100int main(){ int a[N]; int i,j,k,n,m,temp=0; scanf("%d %d",&n,&m); i=0; while(i<n) { scanf("%d",&a[i]); i++; } for(j=0;j< 阅读全文
posted @ 2018-03-28 20:44 计科17-3郭强 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 函数题第三题 void sum_diff( float op1, float op2, float *psum, float *pdiff ) { *psum=op1+op2; pdiff=op1-op2; } psum,pdiff是地址psum,pdiff是值,所以对op1,op2做和差分别交给p 阅读全文
posted @ 2018-03-28 18:59 计科17-3郭强 阅读(128) 评论(1) 推荐(0) 编辑
摘要: 函数第二题 int search( int list[], int n, int x ) { int i; for(i=0;i<n;i++) if (list[i]==x) return i; return -1; } 调用函数中需要从数组第一个元素开始判断是否与x相等,for循环控制循环次数,if 阅读全文
posted @ 2018-03-28 18:55 计科17-3郭强 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 函数题第一题 void splitfloat( float x, int *intpart, float *fracpart ) {int a; float b; a=x/1; b=x-a; *intpart=a;*fracpart =b; } 先想到要将x分成整数和小数,所以要定义一个整形a和浮点 阅读全文
posted @ 2018-03-28 18:53 计科17-3郭强 阅读(91) 评论(0) 推荐(0) 编辑