• R/O
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

練習用です。いろんなものがごちゃまぜです。


Commit MetaInfo

Revision98 (tree)
Time2015-12-28 10:49:18
Authorbellyoshi

Log Message

Change Summary

Incremental Difference

--- tanosii/chap01/chap02/Program.cs (revision 97)
+++ tanosii/chap01/chap02/Program.cs (revision 98)
@@ -10,43 +10,9 @@
1010 {
1111 static void Main(string[] args)
1212 {
13- int[] stoneWeights = new int[] {7,12,5,9,17};
14- int min = stoneWeights[0];
15- int max = stoneWeights[0];
16- int upper10Count = 0;
17- bool existupper12 = false;
18- int sum = 0;
19- foreach(int weight in stoneWeights)
20- {
21- sum += weight;
22- if(weight < min)
23- {
24- min = weight;
25- }
26- if(max < weight)
27- {
28- max = weight;
29- }
30- if (10 < weight)
31- {
32- upper10Count++;
33- }
34- if (12 < weight)
35- {
36- existupper12 = true;
37- }
38- }
39- double avrg = sum / stoneWeights.Count();
13+ list1.start(args);
14+ Console.ReadLine();
4015
41- Console.WriteLine($"10kg以上の石の数は{upper10Count}個です。");
42- Console.WriteLine($"最軽量の石の重さは{min}kgです。");
43- Console.WriteLine($"最重量の石の重さは{max}kgです。");
44- Console.WriteLine($"平均の石の重さは{avrg}kgです。");
45- if (existupper12) {
46- Console.WriteLine("重さ12kgの石は含まれます。");
47- }
48-
49-
5016 }
5117 }
5218 }
--- tanosii/chap01/chap02/list1.cs (nonexistent)
+++ tanosii/chap01/chap02/list1.cs (revision 98)
@@ -0,0 +1,51 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using System.Threading.Tasks;
6+
7+namespace chap02
8+{
9+ class list1
10+ {
11+ public static void start(string[] args)
12+ {
13+ int[] stoneWeights = new int[] { 7, 12, 5, 9, 17 };
14+ int min = stoneWeights[0];
15+ int max = stoneWeights[0];
16+ int upper10Count = 0;
17+ bool existupper12 = false;
18+ int sum = 0;
19+ foreach (int weight in stoneWeights)
20+ {
21+ sum += weight;
22+ if (weight < min)
23+ {
24+ min = weight;
25+ }
26+ if (max < weight)
27+ {
28+ max = weight;
29+ }
30+ if (10 < weight)
31+ {
32+ upper10Count++;
33+ }
34+ if (12 < weight)
35+ {
36+ existupper12 = true;
37+ }
38+ }
39+ double avrg = sum / stoneWeights.Count();
40+
41+ Console.WriteLine($"10kg以上の石の数は{upper10Count}個です。");
42+ Console.WriteLine($"最軽量の石の重さは{min}kgです。");
43+ Console.WriteLine($"最重量の石の重さは{max}kgです。");
44+ Console.WriteLine($"平均の石の重さは{avrg}kgです。");
45+ if (existupper12)
46+ {
47+ Console.WriteLine("重さ12kgの石は含まれます。");
48+ }
49+ }
50+ }
51+}