private void buttonNumber_Click(object sender, EventArgs e) { textBox1.AppendText("人は" + CHito.getCount() + "人\r\n"); textBox1.AppendText("鳥は" + CHito.getCount() + "羽\r\n"); textBox1.AppendText("魚は" + CHito.getCount() + "匹\r\n"); textBox1.AppendText("生き物は" + CHito.getCount() + "体\r\n"); }
private void Form1_Load(object sender, EventArgs e) { ikimonos = new CIkimono[ HITO_NAMES.Length + TORI_NAMES.Length + SAKANA_NAMES.Length]; int index = 0; for (int i = 0; i < HITO_NAMES.Length; i++, index++) { ikimonos[i] = new CHito(HITO_NAMES[i]); textBox1.AppendText("" + index + ":" + HITO_NAMES[i] + "\r\n"); } for (int i = 0; i < TORI_NAMES.Length; i++, index++) { ikimonos[i] = new CTori(TORI_NAMES[i]); textBox1.AppendText("" + index + ":" + TORI_NAMES[i] + "\r\n"); } for (int i = 0; i < SAKANA_NAMES.Length; i++, index++) { ikimonos[i] = new CSakana(SAKANA_NAMES[i]); textBox1.AppendText("" + index + ":" + SAKANA_NAMES[i] + "\r\n"); } }
private void buttonNumber_Click(object sender, EventArgs e) { //選択されているインデックスを所得 int index = int.Parse(txtIndex.Text); //人数を表示 textBox1.AppendText("人は" + CHito.getCount() + "人\r\n"); }
private void Form1_Load(object sender, EventArgs e) { hitoObjects = new CHito[HITO_NAMES.Length]; for (int i = 0; i < HITO_NAMES.Length; i++) { hitoObjects[i] = new CHito(HITO_NAMES[i]); textBox1.AppendText("" + i + ":" + HITO_NAMES[i] + "\r\n"); } }
private void buttonNumber_Click(object sender, EventArgs e) { int index = int.Parse(txtIndex.Text); textBox1.AppendText("人は" + CHito.getCount() + "人\r\n"); textBox1.AppendText("鳥は" + CTori.getCount() + "羽\r\n"); textBox1.AppendText("魚は" + CSakana.getCount() + "匹\r\n"); textBox1.AppendText("生き物は" + CIkimono.getIkimonoCount() + "体\r\n"); }