static void Main(string[] args) { shuzu(); } static void shuzu() { var path ="F:\Englishfour\EnglishWord4.txt"; Read(path); } public static void Read(string path) { List<string> list = new List<string>(); StreamReader sr = new StreamReader(path, Encoding.UTF8); //这个根据文件的编码格式,防止乱码 String line; bool isA = false; while ((line = sr.ReadLine()) != null) { //1.去掉空行 if (string.IsNullOrEmpty(line)) continue; //2.必须是A后面的行 if (line.Contains("A")) isA = true; //3.每行必须包含. 长度大于10个字符 if (isA && line.Contains(".") && line.Length > 10) list.Add(line); } //list实现数据后,设置完成天数, Console.WriteLine("输入完成天数:"); var days = Console.ReadLine();//天数 int num = list.Count;//单词数 if (int.Parse(days) >= 10 && int.Parse(days) <= 100) { int daysword = num / int.Parse(days);//每日背单词数30 int number=0; for (int j = 0; j < int.Parse(days); j++) { Console.WriteLine("开始第{0}天的学习", j+1); //从第一天开始,输出数组前N个单词 //例如一天学习35个单词,第一天就是1-35,第二天就是36-70,以此类推 // number = num / daysword * j; number += daysword; for (int i = number - daysword; i < number; i++) { Console.WriteLine("{0}", list[i]); } Console.WriteLine("-----------------------继续学习---------------------------"); Console.ReadLine(); } } }