using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace _06职工工资文件翻倍练习
{
class Program
{
static void Main(string[] args)
{
//1.读取salary1.txt
using (StreamReader sr = new StreamReader("salary1.txt", Encoding.GetEncoding("gb2312")))
{
//创建一个写入文本文件的文件流
using (StreamWriter sw = new StreamWriter("salary2.txt"))
{
string result;
while ((result = sr.ReadLine()) != null)
{//对每一行进行处理(工资翻倍)
string[] parts = result.Split('|'); //文件内容格式 hzy|8000
parts[] = (Convert.ToInt32(parts[]) * ).ToString();
string newLine = string.Join("|", parts);
sw.WriteLine(newLine);//把newLine的内容写入到文件中。
}
}
}
Console.WriteLine("ok");
Console.ReadKey();
}
}
}