-5

我是编程新手,我正在寻找可以使用 C# 编程向文本文件写入和添加值的源代码。代码应要求用户在控制台窗口中输入值。值是:- 输入姓名,输入帐号,输入余额

输出应以以下格式存储在文本文件中:-

Mark,10001,230000

Steve,10002,32987

Bruce,10003,23454

William,10004,23454

我会很感激一些帮助。

4

1 回答 1

1
string name;
int number1,number2;
// Read name, number1, number2 from Console
//.....
//.....

//Saving in a file:
string outputFileName = @"c:\myfile.txt"
StreamWriter sw = new StreamWriter(outputFileName);
sw.WriteLine(string.Format("{0},{1},{2}",name,number1,number2));
sw.Close();
于 2013-09-11T16:09:40.700 回答