1. 程式人生 > >第一期練習題test6

第一期練習題test6

#include “pch.h”
#include
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;

}