[問題] 字串切割(解決)
解決了...最後程式碼http://pastie.org/2100722
檔案內容
1 3 5 7
2 4 6 8
----------------------------------------------------
我寫了一個讀檔
while (!freader.EndOfStream)
{
token = freader.ReadLine();
intToken = Convert.ToInt32(token.Split(" "));// 這邊不會切字串..
foreach (int i in intToken)
{
total = total + i;
count++;
}
}
全部程式碼在這邊:http://pastie.org/2100591
我想說把讀到的token切割完轉成數字存在intToken陣列裡
然後計算檔案裡數字的總和跟值的個數
裡面宣告是 string token;
int[] intToken=new int[10];
剛學程式的新手~書好像因為這個太簡單結果沒寫ㄒ_ㄒ
爬文好像沒爬到有人問這麼簡單的東西..
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.25.118.131
※ 編輯: g548462 來自: 163.25.118.131 (06/21 18:19)
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章