指针
1、利用指针,编写用于交换两个整型变量值的函数。程序运行结果如下: 输入:5 6 输出:6 5 #include
using namespace std; void swap(int *xp,int *yp) { int tmp; tmp=*xp; *xp=*yp; *yp=tmp; } int main() { int a,b; cin>>a>>b; swap(&a,&b); cout<
#include
using namespace std; int main() { char str[100]; cin>>str; int len; len=strlen(str); char *p=&str[len-1]; while(p>=str) { cout<<*p; p--; } cout<
using namespace std; void selectsort(int *list,int count) { for(int i=0;i
>n; int array[20]; for(int j=0;j
>array[j]; selectsort(array,n); for(int i=0;i