winform文本内容对比

2021-07-02 19:03

阅读:447

标签:wing   for   array   button   题目   windows   获取   raw   ace   

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 WindowsFormsApp3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void pictureBox1_Click(object sender, EventArgs e)
{

}

private void richTextBox1_TextChanged(object sender, EventArgs e)
{

}

private void richTextBox2_TextChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
//题目计数,共75题
int count = 0;
//得分计数,满分115
double piont = 0;
//用于存放获取填写的答案
List answer = new List();
//真实的题库答案,用于对比找出正确与错误的答案
List question = new List { "A", "C", "C", "A", "B", "D", "D", "A", "C", "A", "B", "A", "A", "C", "A", "D", "C", "D", "A", "D", "A", "B", "B", "C", "A", "B", "D", "D", "C", "A", "D", "C", "A", "C", "C", "T", "K", "H", "E", "A", "C", "D", "N", "R", "G", "B", "L", "P", "I", "Q", "F", "M", "J", "S", "O", "A", "A", "C", "D", "D", "D", "D", "A", "A", "B", "C", "C", "B", "A", "A", "B", "B", "A", "C", "B" };
List solve = new List { "A", "C", "C", "A", "B", "D", "D", "A", "C", "A", "B", "A", "A", "C", "A", "D", "C", "D", "A", "D", "A", "B", "B", "C", "A", "B", "D", "D", "C", "A", "D", "C", "A", "C", "C", "T", "K", "H", "E", "A", "C", "D", "N", "R", "G", "B", "L", "P", "I", "Q", "F", "M", "J", "S", "O", "A", "A", "C", "D", "D", "D", "D", "A", "A", "B", "C", "C", "B", "A", "A", "B", "B", "A", "C", "B" };
//用于存放错题
List wrong = new List();
char[] c = richTextBox1.Text.ToCharArray();
foreach (char i in c)
{
if(i.ToString() != "\n")
{
answer.Add(i.ToString());
}
}
while (count {
//答案正确,则加分
if (answer[count] == question[count])
{
if (count {
piont += 1.5;
}
else if (count {
piont += 1;
}
else if (count {
piont += 1.5;
}
else if (count {
piont += 2;
}
//count += 1;
}
//回答错误,连带题号计入错题集
else
{
//count += 1;
if (count {
wrong.Add("\n错题号为:" + (count + 1) + "\n" + "您填的错误选项为:" + answer[count] + "\n" + "正确选项为:" + question[count] + "\n" + "该题目扣1.5分\n" + "该题解析:" + solve[count] + "\n");
}
else if (count {
wrong.Add("\n错题号为:" + (count + 1) + "\n" + "您填的错误选项为:" + answer[count] + "\n" + "正确选项为:" + question[count] + "\n" + "该题目扣1分\n" + "该题解析:" + solve[count] + "\n");
}
else if (count {
wrong.Add("\n错题号为:" + (count + 1) + "\n" + "您填的错误选项为:" + answer[count] + "\n" + "正确选项为:" + question[count] + "\n" + "该题目扣1.5分\n" + "该题解析:" + solve[count] + "\n");
}
else if (count {
wrong.Add("\n错题号为:" + (count + 1) + "\n" + "您填的错误选项为:" + answer[count] + "\n" + "正确选项为:" + question[count] + "\n" + "该题目扣2分\n" + "该题解析:" + solve[count] + "\n");
}
}
count += 1;
//Task.Delay(200);
}
richTextBox2.AppendText("选择题总分为:115 分" + "\n");
richTextBox2.AppendText("您的选择题得分为:" + piont + " 分\n");
count = 0;
while (count {
richTextBox2.AppendText(wrong[count]);
count += 1;
}
}
}
}

winform文本内容对比

标签:wing   for   array   button   题目   windows   获取   raw   ace   

原文地址:https://www.cnblogs.com/Lee597/p/14962542.html


评论


亲,登录后才可以留言!