int a[]={5,10,15,20,25,30}; int b=LA(a,4); int c=LA(a+2,3);printf("%d\n %d\n",b,#include "stdio.h"int LA(int *a,int n){int i,s=0;for(i=0;i

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 17:02:14
inta[]={5,10,15,20,25,30};intb=LA(a,4);intc=LA(a+2,3);printf("%d\n%d\n",b,#include"stdio.h"intLA(int

int a[]={5,10,15,20,25,30}; int b=LA(a,4); int c=LA(a+2,3);printf("%d\n %d\n",b,#include "stdio.h"int LA(int *a,int n){int i,s=0;for(i=0;i
int a[]={5,10,15,20,25,30}; int b=LA(a,4); int c=LA(a+2,3);printf("%d\n %d\n",b,
#include "stdio.h"
int LA(int *a,int n)
{
int i,s=0;
for(i=0;i

int a[]={5,10,15,20,25,30}; int b=LA(a,4); int c=LA(a+2,3);printf("%d\n %d\n",b,#include "stdio.h"int LA(int *a,int n){int i,s=0;for(i=0;i
int a[]={5,10,15,20,25,30};这一句的意思是定义一个数组a,a中存了5,10,15,20,25,30这6个数
LA函数有两个参数,一个数组a(a就代表一个指针值),一个n,函数的作用是求数组a中前n个数的和.
int b=LA(a,4);参数是a和3,所以a就代表以上定义的数组a的首地址,也就是从5开始,这一句的意思是将数组a中的前4个数求和,结果存在b中,所以b=5+10+15+20=50
int c=LA(a+2,3);参数是a+2和3,a代表数组a的首地址,a+2就将指针移到15那,这一句的意思是将数组a中从第3个算起的3个数求和存在c中,所以c=15+20+25=60.

int a[]={5,10,15,20,25,30}; int b=LA(a,4); int c=LA(a+2,3);printf(%d %d ,b,#include stdio.hint LA(int *a,int n){int i,s=0;for(i=0;i #define N 20 fun(int a[],int n,int m) {int i; for(i=m;i>n;i--)a[i+1]=a[i]; return m; } void main() #define N 20fun(int a[],int n,int m){int i;for(i=m;i>n;i--)a[i+1]=a[i];return m;}void main(){ int i,a[N]={1,2,3,4,5,6,7,8,9,10};fun(a,0,N/2);for(i=0;i 矩阵相加(C++)#include using namespace std; const int rows=3;const int cols=3;void matrixadd(int *,int *,int *,int,int);int main(){int a[rows][cols]={{1,3,5},{7,8,11},{13,15,17}};int b[rows][cols]={{9,8,7},{6,5,4},{3,2,1}};int c[rows][cols]={0 int a = 20;int b = 10;交换 a,b 的值 #include int b=2; int fun(int *k) {b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8}, #define N 20 fun(int a[],int n,int m) { int i; for(i=m;i>=n;i--) a[i+1]=a[i]; return a[a+1]; } main#define N 20fun(int a[],int n,int m){ int i;for(i=m;i>=n;i--)a[i+1]=a[i];return a[a+1];}main(){int i,a[N]={1,2,3,4,5,6,7,8,9,10};fun(a,2,9);for(i=0;i 合并排序 #includestdio.hvoid merge(int*a,int p,int q,int m){int t[20];int k[20];int n1=q-p+1;int n2=m-q;for(int i=0;i 下列程序的输出结果是#define N 20void fun (int a[ ],int n,int m){int i,j;for (i=m;i>n;i--)a[i+1]=a[i];}main(){int i,a[N]={1,2,3,4,5,6,7,8,9,10};fun(a,2,9);for(i=0;i int a=2; int f(int a); {return (a)++;} main() {int s=0; {int a=5; s+=f(&&a);} s+=f(&&a); printf(%da=2;int f(int a);{return (a)++;}main(){int s=0;{int a=5;s+=f(&&a);}s+=f(&&a);printf(%d ,s);}执行的输出结果是()A 10 B 9 C 7 D 8 已知int a=10,b=15;,表达式!a #include int a=3,b=5; max (int a,int b) {int c; c=a>b?a:b; return (c); } void main() {int #include int b=2; int fun(int*k) { b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8}#include int b=2; int fun(int*k) { b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8},i;for(i=2;i void fun(int a,int b) { int t; t=a;a=b;b=t; } main()void fun(int a,int b){ int t; t=a;a=b;b=t; } main() { int c[10]={1,2,3,4,5,6,7,8,9,0}.i; for(i=0;i int a=10;f1(){int a=20;printf(%d,a);}f2(){printf(%d,a);}main ( ){int a=30;f1();f2(); printf(a)int a=10;f1(){int a=20;printf(%d,a);}f2(){printf(%d,a);}main ( ){int a=30;f1();f2();printf(%d,a);}答案是 20 10 30求解答. fun ( int *p ) { int a=10; p = &a; ++a; } main ( ) { int a=5; fun (&a); printf (%d ,a); }#include fun ( int *p ) { int a=10; p = &a; ++a; } main ( ) { int a=5; fun (&a); printf (%d ,a); } struct st{int x,int*y;}*p; int s[]={5,6,7,8} st a[]={10,&s[0],20,&s[1]30,&[2],40,&s[3]} main( ) {p=a;cout 阅读下面程序,执行后的结果#include stdio.hvoid fun(int *a,int *b){int k;k=5;*a=k;*b=*a+k;}main(){int *a,*b,x=10,y=15;a=&x;b=&y;fun(a,b);printf(%d,%d ,*a,*b);} #includestdio.h num() { extern int x,y; int a=15,b=10; x=a-b; y=a+b; return; } int x,y; void main运行结果是5,25,{int a=7,b=5;x=a+b;y=a-b;num();printf(%d,%d ,x,y);}我学艺不精啊,