1 Star 0 Fork 1

阿炯/一起来击键

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
文本测试结果窗体.cs 2.84 KB
一键复制 编辑 原始数据 按行查看 历史
cloverlzy 提交于 2020-12-05 21:57 . v1.0版本
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 一起来击键
{
public partial class 文本测试结果窗体 : Form
{
public 文本测试结果窗体(string user_input,string str, int time)//shuzu1用户输入,shuzu2标准答案,sudu_速度,time_用时
{
InitializeComponent();
int chengji = 0;
string cuo_daan = "", cuo_qing = "";
int correct = 0, worng = 0;
string a = str.Replace("  ", "").Replace("\n", ""); //删掉全角空格
string b = user_input.Replace(" ", "").Replace("\n", "");
int input_count = user_input.Replace(" ", "").Replace("\n", "").Length;
int sudu = (int)(input_count / (time + 0.0001) * 360);
for (int i = 0; i < b.Length; i ++) //对比找出错情
{
try
{
if (a.Substring(i, 1) == b.Substring(i, 1))
correct = correct + 1;
else
{
worng = worng + 1;
cuo_daan = cuo_daan + a.Substring(i, 1);
cuo_qing = cuo_qing + b.Substring(i, 1);
}
}
catch (Exception)
{
int j = 0;
}
}
if (worng == 0)
chengji = sudu;
else if (correct / worng >= 150)
chengji = sudu;
else
{
if (correct - worng * 150 >= 0)
chengji = (int)correct / time * 60;
else chengji = 0;
}
label6.Text = input_count.ToString(); //显示输入的总字数
label7.Text = worng.ToString(); //显示错情个数
label8.Text = time.ToString(); //显示时间
label9.Text = sudu.ToString(); //显示速度
textBox1.Text = "正确:" + cuo_daan;
textBox2.Text = "错误:" + cuo_qing;
label10.Text = chengji.ToString();
if (chengji < 300)
label13.Text = "不合格";
else if (chengji < 350)
label13.Text = "合格";
else if (chengji < 400)
label13.Text = "一般";
else if (chengji < 450)
label13.Text = "良好";
else if (chengji < 500)
label13.Text = "优秀";
else if (chengji >= 550)
label13.Text = "满分";
}
private void 文本测试结果窗体_Load(object sender, EventArgs e)
{
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/syj1996/hit-the-keyboard.git
git@gitee.com:syj1996/hit-the-keyboard.git
syj1996
hit-the-keyboard
一起来击键
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385