を取得することはできませんここでは私の主な方法はここで正しく出力ファイルに書き込む方法やカント編集
static void Main()
{
int id, age, exp;
double avgAge, avgExp, ageSum = 0, expSum = 0, empSum = 0;
char type;
double total = 0;
OpenFiles();
PrintReportHeadings();
while ((lineIn = fileIn.ReadLine()) != null)
{
empSum++;
ParseLineIn(out id, out type, out age, out exp);
UpdateTotals(ref ageSum, ref expSum, age, exp);
string eligibility = GetEligibility(type, age, exp);
PrintDetailLine(id, type, age, exp, eligibility);
}
avgAge = CalcAvg(ageSum, empSum, out total);
avgExp = CalcAvg(expSum, empSum, out total);
PrintAvg(avgAge, avgExp);
CloseFiles();
}
は私PrintAvg方法である:
static void PrintAvg(double avgAge, double avgExp)
{
fileOut.Write("\nAvg\t {0:f1} {1:f1}", avgAge, avgExp);
}
そして、VisualStudioを
Employee Report
ID Age Exp Eligibility
---- --- --- -----------
1235 45 20 lack of exp age
2536 55 21 lack of exp age
5894 60 30 lack age
4597 75 35 can retire
2597 35 10 lack of exp age
5689 40 20 lack of exp age
5489 55 39 lack age
5872 60 40 can retire
5569 55 25 can retire
5566 80 20 lack of exp
8865 59 35 can retire
5598 65 35 can retire
の私の出力ファイル
さらに、メモ帳の出力ファイル...
Employee Report
ID Age Exp Eligibility
---- --- --- -----------
1235 45 20 lack of exp age
2536 55 21 lack of exp age
5894 60 30 lack age
4597 75 35 can retire
2597 35 10 lack of exp age
5689 40 20 lack of exp age
5489 55 39 lack age
5872 60 40 can retire
5569 55 25 can retire
5566 80 20 lack of exp
8865 59 35 can retire
5598 65 35 can retire
Avg 57.0 27.5
メモ帳では平均値が表示されますが、PrintAvgメソッドを編集して平均行を下げるための改行を試しても影響はありません。どのように私はこれを修正するのですか?
なぜWriteLineを使用しないのですか? –
私は先に進んで –
を使用して解決しましたか?私はポイントの答えを投稿できますか? :) –