老陈 WPF

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
namespace 老陈Wpf
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        public static int Count = 0;
        public static int right = 0;
        int m = 0;

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            StreamWriter n1 = File.AppendText("C:\\n1.txt");
            n1.WriteLine(textBox1.Text);
            n1.Close();
            StreamWriter n2 = File.AppendText("C:\\n2.txt");
            n2.WriteLine(textBox2.Text);
            n2.Close();
            StreamWriter n3 = File.AppendText("C:\\n3.txt");
            n3.WriteLine(textBox3.Text);
            n3.Close();
            MessageBox.Show("录题成功");
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            //出题
            string[] n1 = new string[100];
            n1 = File.ReadAllLines("C:\\n1.txt");
            textBox1.Text = n1[m];
            string[] n2 = new string[100];
            n2 = File.ReadAllLines("C:\\n2.txt");
            textBox2.Text = n2[m];
            string[] n3 = new string[100];
            n3 = File.ReadAllLines("C:\\n3.txt");
            textBox3.Text = n3[m];
            m++;
        }
        //结束
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            textBox5.Text = MainWindow.Count.ToString();//题目总数
            textBox6.Text = MainWindow.right.ToString();
            textBox7.Text = ((MainWindow.right / (double)(MainWindow.Count)) * 100).ToString() + "%";//正确率
        }

        private void textBox4_KeyDown(object sender, KeyEventArgs e)
        {
            int a = int.Parse(textBox1.Text);
            int b = int.Parse(textBox3.Text);
            Char c = Convert.ToChar(textBox2.Text);
            Class1 con = new Class1();
            con.chu(a, b, c);
            if (e.Key == Key.Enter)
            {

                if (con.answer == int.Parse(textBox4.Text))
                {
                    MessageBox.Show("回答正确!下一题请按开始按钮!");
                    right++;
                    Count++;
                }

                else
                {

                    MessageBox.Show("回答错误!下一题请按开始按钮!");
                    Count++;

                }
                textBox4.Clear();
            }
        }

        private void button1_Click_1(object sender, RoutedEventArgs e)
        {
            StreamWriter n1 = File.AppendText("C:\\n1.txt");
            n1.WriteLine(textBox1.Text);
            n1.Close();
            StreamWriter n2 = File.AppendText("C:\\n2.txt");
            n2.WriteLine(textBox2.Text);
            n2.Close();
            StreamWriter n3 = File.AppendText("C:\\n3.txt");
            n3.WriteLine(textBox3.Text);
            n3.Close();
            MessageBox.Show("录题成功");
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
        }
    }
}

 封装

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 老陈Wpf
{
    class Class1
    {
        public int sum;
        public int answer
        {
            get
            {
                return sum;
            }
        }

        public int chu(int n1, int n2, char fuhao)
        {
            if (fuhao == ‘+‘)
            {
                return sum = n1 + n2;
            }
            else if (fuhao == ‘-‘)
            {
                return sum = n1 - n2;
            }
            else if (fuhao == ‘*‘)
            {
                return sum = n1 * n2;
            }
            return sum;

        }
    }
}

  运行的界面如下:

时间: 2024-08-07 03:03:38

老陈 WPF的相关文章

小石头和老陈

名字 老陈 性别.年龄 男.40岁 职业 教师 收入 3000 知识层次和能力 熟知计算机 生活/工作情况 教学    动机,目的,困难 帮助孩子辅导作业 用户偏好 学习计算机相关书籍     用户比例 ? 典型场景 做一个可可以计时统计正确率的计算机软件 典型描述 可以让孩子更好的学习1 名字             小石头 性别.年龄 男,8 岁 职业 无 收入 无 知识层次和能力 小学二年级 生活/工作情况 上课 动机,目的,困难 提高做题速度 用户偏好 玩手机 用户比例 ? 典型场景 学

对于牛老师作业陈老师作业补充(老陈、小石头的典型用户、用例图、场景)

对于牛老师作业陈老师作业补充(老陈,小石头的典型用户.用例图.场景) 一  :  典型用户 (1)名字:小石头 性别:男 年龄:    8岁 职业:学生 收入:无 知识层次能力:小学二年级 生活/工作情况:父母抚养,无工作 动机,目的,困难:想测试自己的运算速度 用户偏好:上网,打小游戏,看动画片 典型场景:放学回家后,老陈了解他的学习情况 典型描述:正确率越高,小石头学的越好 (2)名字:老陈 性别:男 职业:大学教师 年龄:   40岁 收入:6000/月 知识层次能力:本科毕业 生活/工作

老陈 小石头 典型事例

名字 老陈 性别,年龄 男,40岁 职业 大学老师 收入 5000/月 知识层次和能力 熟知计算机专业知识 生活,工作情况 在大学教书,有一个8岁的儿子 动机,目的,困难 想要一个软件帮助儿子做作业 用户偏好 看书,晒太阳 用户比例 ? 典型场景 辅导孩子做作业 典型描述 辅导孩子加减法运算,10以内乘法运算   名字 小石头 性别,年龄 男,8 职业 小学生 收入 - 知识层次和能力 小学二年级,只会加减法,10以内乘法 生活,工作情况 - 动机,目的,困难 练习四则运算 用户偏好 看电视,做

典型用户分析(小石头,老陈)

典型用户 名字:小石头 年龄.性别:9岁,男 职业:小学二年级学生 收入:无 知识层次能力:小学二年级 生活/工作情况:父母抚养,无工作 动机,目的,困难:想测试自己的运算速度 用户偏好:玩, 典型场景:放学回家后,老陈了解他的学习情况 典型描述:正确率越高,小石头学的越好 名字:老陈 年龄.性别:40岁,男 职业:大学教师 收入:5000/月 知识层次能力:本科毕业 生活/工作情况:生活美满,工作很好 动机,目的,困难:想测试孩子的学习 用户偏好:专研计算机, 典型场景:放学回家后,解决不能辅

老陈与小石头

(1)典型故事 名字 老陈 年龄 45岁 职业 教师 知识层次和能力 本科毕业,能熟练操作电脑 用户偏好 上网查资料,看书 用户比例 50% 典型场景 辅导孩子完成家庭作业 典型描述 希望多些空闲时间 名字 小石头 年龄 8岁 职业 小学生 知识层次和能力 小学二年级学生,可以完成两位数的连加连减,能简单操作电脑 用户偏好 玩游戏,看电视 用户比例 50% 电型场景 完成家庭作业,遇到困难请父母帮助 典型描述 回家后完成家庭作业 (2)场景用例图 (3)用户故事 老陈:作为一个能熟练操作电脑的家

老陈,小石头、

1.背景 (1)典型用户: 老陈: 名字 老陈 性别.年龄 男,40岁 职业 大学老师 收入 1万元/月 知识层次喝能力 大学,能够熟练操作电脑基本功能,喜欢上网,发邮件 生活/工作情况 已婚/在大学任教 动机,目的,困难 作为一名老师每天要处理的问题比较多,没有过多的时间辅导孩子学习, 想借用此软件来辅导孩子学习以便于节省更多的时间 用户偏好 阅读 用户比例 50% 典型场景 借用程序节省时间工作 典型描述 工作繁忙,没有时间辅导孩子 小石头: 名字 小石头 性别.年龄 男,8岁 职业 小学二

老陈与小石头运算代码

总结:在这次作业中学会了封装,但是还是不会运用策略模式.Form1窗体的代码using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace 老

对于牛老师作业陈老师作业补充(老陈,小石头的典型用户、用例图、场景)

典型用户 名字:小石头 性别:男 职业:小学二年级学生 收入:无 知识层次能力:小学二年级 生活/工作情况:父母抚养,无工作 动机,目的,困难:想测试自己的运算速度 用户偏好:玩, 典型场景:放学回家后,老陈了解他的学习情况 典型描述:正确率越高,小石头学的越好 名字:老陈 性别:男 职业:大学教师 收入:5000/月 知识层次能力:本科毕业 生活/工作情况:生活美满,工作很好 动机,目的,困难:想测试孩子的学习 用户偏好:专研计算机, 典型场景:放学回家后,解决不能辅导孩子的空缺 典型描述:正

老陈---谈Delphi中SSL协议的应用[转]

摘要:本文主要介绍如何在Delphi中使用SSL协议.一共分为七个部分:(1)SSL协议是什么?(2)Delphi中如何使用SSL协议?(3)SSL客户端编程实例.(4)SSL服务端编程实例.(5)SSL证书编程实例.(6)中间人欺骗实例.(7)其它.本文作者同时有一个用SSL协议编写的作品叫SSLPROXY,感兴趣的读者可以从作者主页http://www.138soft.org下载. 一:SSL协议是什么?  SSL是一种加密传输协议.引用网上一段话:SSL 是Secure socket La