第一期练习题test6

#include "pch.h"
#include <iostream>
using namespace std;

int main()
{

	char a[3];
	while (cin >> a)
	{
		char*p = a; 
		for (int i =0 ; i < 2; ++i)
		{
			for (int t = i; t < 3; ++t)
			{
				if (p[i] > p[t])
				{
					char x=p[i];
					p[i] = p[t];
					p[t] = x;
				}
			}
		}
		for (int i = 0; i < 3; ++i)
		{
			cout << *p << ' ';
			++p;
		}
		cout << endl;
	}
	return 0;
}
阅读更多

没有更多推荐了,返回首页