C#输入英文句子

来源:百度知道 编辑:UC知道 时间:2024/05/09 12:26:36
从标准设备中输入若干行英文句子,直到输入"bye"结束,将这些字符串写入文件。

using System;
using System.IO;

namespace Example
{
class OprateFile
{
public OprateFile()
{
total = "";
temp = "";
}
public void readInf()
{
while (temp != "bye")
{
temp = Console.ReadLine();
total += temp + "\r\n";
}
}

public void WriteInf()
{
using (StreamWriter sw = new StreamWriter("C:\\Text.txt", false))
{
sw.Write(total);
}

}
private string total;
private string temp;
}

class TestDelegates
{
static void Main()
{
OprateFile of =