[Init] Solved solutions

This commit is contained in:
tiennm99 committed 2023-03-02 20:58:03 +07:00
1 parent 51f667ac81
commit 20542601dd
131 files changed
+4148

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
#include <iostream>
#include <sstream>
#define MAX_SIZE 100
using namespace std;
int main()
{
string s;
stringstream ss;
getline(cin, s);
ss.str(s);
int arr[MAX_SIZE];
char c;
int n = 0;
while(!ss.eof())
{
ss >> arr[n++] >> c;
}
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
if (arr[j] < arr[i])
{
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
for (int i = 0; i < n; i++)
{
cout << arr[i];
if (i != n - 1)
{
cout << '+';
}
}
cout << endl;
return 0;
}