标签:style blog color io os ar for strong sp
#define LOCAL
#include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
typedef int ElemType;
const int maxSize=10;
//传入函数的一维数组经过函数之后数组元素发生变化
int REV(int *a,int x,int y)
{
int i=x,j=y;
while(i<j)
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
i++;j--;
}
}
//传入函数的二维数组第二个数字必须是固定的
int array(int a[][maxSize],int n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<maxSize;j++)
{
cout<<a[i][j]<<",";
}
cout<<endl;
}
cout<<endl;
}
int main()
{
#ifdef LOCAL
freopen("3.in","r",stdin);
freopen("3.out","w",stdout);
#endif
int a[maxSize],b[5][maxSize],n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
for(int j=0;j<maxSize;j++)
{
cin>>b[i][j];
}
}
REV(a,0,n-1);
for(int i=0;i<n;i++)
{
cout<<a[i]<<",";
}
cout<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<maxSize;j++)
{
cin>>b[i][j];
}
}
array(b,5);
return 0;
}
标签:style blog color io os ar for strong sp
原文地址:http://www.cnblogs.com/jianfengyun/p/4011426.html