Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9725

cscの作法 その85

$
0
0
概要 cscの作法、調べてみた。 練習問題やってみた。 練習問題 認知症チェックアプリを作れ。 写真 サンプルコード using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace App { public class Form1 : Form { string[] toi = new string[] { " 同じことを何回も言ったり聞いたりする", " 今切ったばかりなのに電話の相手の名前を忘れる", " しまい忘れ・置き忘れが増え、いつも探しものをしている", " よく知っている人の名前を忘れる", " ものの名前が出てこなくなった", " 簡単な計算の間違いが多くなる、いつも大きなお金で支払いをする", " 料理・片付け・運転などのミスや、蛇口・ガス栓の閉め忘れが多くなった", " 雑誌や新聞、テレビ番組の内容が理解できなくなった", " 薬の飲み忘れが多くなった", " 今日の日付・時間がわからない", " 慣れているところでも道に迷うことがある", " 約束の日時・場所を忘れたり 間違えたりする", " ささいなことで怒りっぽくなった", " 自分の失敗を人のせいにしたり、以前よりも疑い深くなった", " 趣味や好きなテレビ番組に興味を示さなくなった", " 身だしなみに気をかけなくなった", " 一人で外出することが減った", " 気分が落ち込みやすくなった", }; Button button1; public Form1() { Text = "認知症チェックシート"; button1 = new Button(); button1.Font = new Font("MS UI Gothic", 12F, FontStyle.Regular, GraphicsUnit.Point, ((System.Byte)(128))); button1.Location = new Point(68, 32); button1.Name = "button1"; button1.Size = new Size(104, 32); button1.TabIndex = 1; button1.Text = "Start"; Controls.Add(button1); button1.Click += button1_Click; } private void button1_Click(object sender, EventArgs e) { int[] ans = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int h = 0; for (int i = 0; i < 18; i++) { DialogResult res = MessageBox.Show(toi[i], "問い", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res.ToString() == "Yes") ans[i] = 1; } for (int i = 0; i < 18; i++) { if (ans[i] > 0) h = h + 1; } if (h > 4) MessageBox.Show("5つ以上チェックがある人は認知症の可能性があります。"); else MessageBox.Show("まだ、大丈夫です。"); } [STAThread] static void Main() { Application.Run(new Form1()); } } } 以上。

Viewing all articles
Browse latest Browse all 9725

Trending Articles