- 婚礼上的小杉
- 2019-07-24 10:44:36 @
# include <iostream>
# include <cstring>
using namespace std;
int main()
{
int i = 0, j, k;
int a[1000];
string b[1000];
int temp1;
string temp2;
while(cin >> a[i])
{
i++;
if(cin.get() == '\n')
{
break;
}
}
for(j = 0; j < i; j++)
{
cin >> b[j];
}
for(j = 0; j < i-1; j++)
{
for(k = 1; k < i; k++)
{
if(a[j] > a[k])
{
temp1 = a[j];
a[j] = a[k];
a[k] = temp1;
temp2 = b[j];
b[j] = b[k];
b[k] = temp2;
}
}
}
for(j = 0; j < i - 1; j++)
{
cout << b[j] << endl;
}
cout << b[i-1];
return 0;
}
0 条评论
目前还没有评论...