【思路】:三个数排序。最保险的方法用sort函数,其他的就是基本知识了。注意顺序就行。
【AC代码】:
#include <iostream>#include <algorithm>#include <iomanip>#include <cstdio>#include <cstring>using namespace std;void swap(int *a, int *b){int temp = *a;*a = *b;*b = temp;}int main(){//freopen("in.txt", "r", stdin);int a = 0, b = 0, c = 0;//inputcin >> a >> b >> c;//exchangeif (b > a)swap(a, b);if (c > b)swap(b, c);if (b > a)swap(a, b);//outputcout << a << " " << b << " " << c;}
,但要相信真诚的爱情,对爱情永远怀有单纯的向往。