using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Globalization;
namespace __3
{
class Program
{
static void Main(string[] args)
{
string[] sname = new string[10];
string[] unmber = new string[10];
string tempn = "",temp="";
for (int i = 1; i <= 10; i++)
{
Console.WriteLine("請輸入第" + i + "個親友的姓名");
sname[i - 1] = Console.ReadLine();
Console.WriteLine("請輸入第" + i + "個親友的電話");
unmber[i - 1] = Console.ReadLine();
}
for (int i = 0; i < 9; i++)
{
for (int j = i; j < 10; j++)
{
if (sname[i].CompareTo(sname[j])>0)
{
temp = unmber[i];
unmber[i] = unmber[j];
unmber[j] = temp;
tempn = sname[i];
sname[i] = sname[j];
sname[j] = tempn;
}
}
}
Console.WriteLine("由小至大排序:");
for (int i = 0; i < 10; i++)
{
Console.Write(sname[i] + "\t");
Console.Write(unmber[i] + "\t\n");
}
Console.WriteLine("由大至小排序:");
for (int i = 9; i >= 0; i--)
{
Console.Write(sname[i] + "\t");
Console.Write(unmber[i] + "\t\n");
}
}
}
}