📄 指针传递数组.cpp
字号:
#include<iostream.h>
void count(int *b,int n);
void main()
{int a[10],i;
cout<<"please input the number of a"<<endl;
int *p=new int[10];
for(i=0;i<10;i++)
cin>>p[i];
cout<<"we can get a new round after the count"<<endl;
count(p,10);
for(i=0;i<10;i++)
cout<<p[i]<<" ";
}
void count(int *b,int n)
{int i,j,t;
for(i=0;i<(n-1)/2;i++)
{j=n-1-i;
t=b[i];
b[i]=b[j];
b[j]=t;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -