c++指针类练习题及答案.docxVIP

  • 221
  • 0
  • 约7.01千字
  • 约 13页
  • 2021-11-26 发布于江苏
  • 举报
1、 1、利用指针,编写用于交换两个整型变量值的函数。程序运行结果如下: 输入:5 6 输出:6 5 #include iostream using namespace std; void swap(int *xp,int *yp) { int tmp; tmp=*xp; *xp=*yp; *yp=tmp; } int main() { int a,b; cinab; swap(a,b); couta bendl; return 0; } 2、 2、编写主程序,将输入字符串反序输出。程序运行结果如下: 输入:ABCDEFGHIJK 输出:KJIHGFEDCBA #includeiostream

文档评论(0)

1亿VIP精品文档

相关文档