using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
List<string> arrWords = new List<string>();
while (true)
{
Console.Write("Type a word: ");
string arrInput = Console.ReadLine();
if (arrInput == "")
{
break;
}
arrWords.Add(arrInput);
}
for (int i = 0; i < arrWords.Count; i++)
{
for (int j = i + 1; j < arrWords.Count; j++)
{
if (arrWords[i] > arrWords[j])
{
string temp = arrWords[i];
arrWords[i] = arrWords[j];
arrWords[j] = temp;
}
}
}
foreach (string arrWord in arrWords)
{
Console.WriteLine(arrWord);
}
}
}
}
有人可以告诉我如何不使用(List.Reverse())来反转字符串列表的顺序吗?
例如: 1.牛 2.猫 3.狗 反转后: 4.狗 5.猫 6.牛
只需按降序排列即可!
答案 0 :(得分:0)
您在这里:
404 (Not Found)
答案 1 :(得分:0)
require 'watir'
require 'webdrivers'
require 'webdriver-user-agent'
args = ['--remote-debugging-address=0.0.0.0','--remote-debugging-port=9222','--no-sandbox','window-size=1024,768','--headless',' --proxy-server=localhost:8080']
driver = Webdriver::UserAgent.driver(:browser => :chrome,:agent => :random,:args => args)
browser = Watir::Browser.new driver