标题:怎么将以下代码用到asp.net的网站上,即是vs新建网站中的asp.net网站。
取消只看楼主
woaiyanyan
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-12-17
 问题点数:0 回复次数:0 
怎么将以下代码用到asp.net的网站上,即是vs新建网站中的asp.net网站。
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
    public partial class Form1 : Form
    {
        int x,y,n;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "石头")
            { y = 1; }
            else
            {
                if (textBox1.Text.Trim() == "剪刀")
                {y=2; }
                else
                {
                    if (textBox1.Text.Trim() == "步")
                    { y = 3; }
                    else { MessageBox.Show("输入错误!"); }
                }
            }
            Random m = new Random();
            x = m.Next(3);
            if (x == 1) { label1.Text = "石头"; }
            else { if (x == 2) { label1.Text = "剪刀"; } else { label1.Text = "布"; } }
            if(x==1&&y==1||x==2&&y==2||x==3&&y==3){MessageBox.Show("平局!");}
            else
            {
                if(x==1&&y==2||x==2&&y==3||x==3&&y==1){MessageBox.Show("您输了!");}
                else{MessageBox.Show("您赢了!");n++;}
            }
            if(n==3){MessageBox.Show("本局您获胜!");n=0;}

        }
    }
}   
搜索更多相关主题的帖子: private public 网站 新建 
2014-12-17 20:12



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-440059-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.521787 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved