C#编程题比较两个数a和b的大小,如果a小于b,则交换二者的值,使得a大于b。赋值语句问题不懂,急急急。。
2019-11-15
展开全部
#include <iostream>
using namespace std;
void swap(short int *p1, short int* p2)
{
short int p;
{p = *p1; *p1 = *p2; *p2 = p; }
}
void main()
{
short int a, b;
short int* p_1, * p_2;
cin >> a >> b;
p_1 = &a; p_2 = &b;
if (a < b) swap(p_1, p_2);
cout << a << " " << b;
}
using namespace std;
void swap(short int *p1, short int* p2)
{
short int p;
{p = *p1; *p1 = *p2; *p2 = p; }
}
void main()
{
short int a, b;
short int* p_1, * p_2;
cin >> a >> b;
p_1 = &a; p_2 = &b;
if (a < b) swap(p_1, p_2);
cout << a << " " << b;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询