lovemi93

1:代码如下:

// 5.2.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
using namespace std;
void main()
{
    int *p1,*p2;
    int    *p;        //临时指针
    int a,b;
    cout << "input a: " << endl;
    cin >> a;
    cout << "input b: " << endl;
    cin >> b;
    p1=&a;p2=&b;
    if(a<b)
    {
        p=p1;
        p1=p2;
        p2=p;
    }
    cout << "a=" << a;
    cout << " ";
    cout << "b=" << b;
    cout << endl;
    cout << "较大的数:" << *p1 << "较小的数: "<< *p2 <<endl;
}
View Code

运行结果:

分类:

技术点:

相关文章:

  • 2021-10-12
  • 2021-06-14
  • 2022-03-12
  • 2022-02-18
  • 2021-08-21
  • 2021-09-30
猜你喜欢
  • 2021-11-21
  • 2021-09-19
  • 2021-10-07
  • 2021-11-07
  • 2022-12-23
相关资源
相似解决方案