using System;
//以下の名前空間を追加
using System.Collections.Generic;
namespace dictionary_weights
{
class MainClass
{
public static void Main(string[] args)
{
// Dictionaryを使い日付と体重データを保持する例
// 1. Dictionary型の変数を作る
Dictionary<string, float> weights = new Dictionary<string, float>();
// 2. Dictionaryに要素を追加
weights.Add("2017/12/10", 62.6f);
weights.Add("2017/12/11", 21.9f);
weights.Add("2017/12/12", 41.8f);
weights.Add("2017/12/13", 62.1f);
weights.Add("2017/12/14", 42.7f);
weights.Add("2017/12/15", 82.1f);
weights.Add("2017/12/16", 63.8f);
weights.Add("2017/12/17", 23.8f);
// 3. 2017/12/13の体重を表示
Console.WriteLine(weights["2017/12/13"]);
}
}
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00