View Code of Problem 78

#include<bits/stdc++.h>
using namespace std;
int main() {
	char c[3][1000],t[1000];
	for(int i=0; i<3; i++) cin>>c[i];
	for(int i=0; i<2; i++) {
		for(int j=1; j<3; j++) {
			if(strcmp(c[i], c[j])>0) {//交换 
				strcpy(t,c[i]);
				strcpy(c[i],c[j]);
				strcpy(c[j],t);
			}
		}
	}
	for(int i=0; i<3; i++) cout<<c[i]<<endl;
}

Double click to view unformatted code.


Back to problem 78