题目链接 https://pintia.cn/problem-sets/994805046380707840/problems/994805132040978432
题目
本题要求将输入的任意3个整数从小到大输出。
输入格式:
输入在一行中给出3个整数,其间以空格分隔。
输出格式:
在一行中将3个整数从小到大输出,其间以“->”相连。
输入样例:
4 2 8
输出样例:
2->4->8
AC代码
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
int s[20];
scanf("%d%d%d",&s[0],&s[1],&s[2]);
sort(s,s+3);
printf("%d->%d->%d",s[0],s[1],s[2]);
return 0;
}