| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1009 人关注过本帖
标题:魔兽密保卡效果,精通数组的大虾请进!
只看楼主 加入收藏
雪雨星风
Rank: 1
来 自:北京
等 级:新手上路
威 望:1
帖 子:566
专家分:0
注 册:2007-10-11
结帖率:100%
收藏
 问题点数:0 回复次数:5 
魔兽密保卡效果,精通数组的大虾请进!
[free] 我想做一个类似魔兽密保卡的系统:密保卡如下
但我的数组学的不好,哪位高人帮忙解决下
所要效果如下
登录账号时随即生成6个字母 比如 AEBDHF
那吗需要用户从密保卡上找到对应的数字填入才能验证成功登录
验证是先找行再找列  AEBDHF  对应的数字为115432
       A       B       C     D     E     F      G     H      I       J     K     L      M      N
A    11     12     13   14    15    16    17    18   19    20   21    22    23    24
B     25    26     27   28    29    30    31    32    33   34   35   36     37    38
C    39    40      41   42    43    44    45    46   47    48   49   50     51    52
D    53    54      55   56    57    58    59    60    61   62   63   64     65    66   
E    11     12     13   14    15    16    17    18   19    20   21    22    23    24
F     25    26     27   28    29    30    31    32    33   34   35   36     37    38
G   39    40      41   42    43    44    45    46   47    48   49   50     51    52
H    53    54      55   56    57    58    59    60    61   62   63   64     65    66   

我想应该是用二维数组吧
很紧急   高手帮忙  小弟不甚感激
[/free][free] 动态网站开发交流群5953354欢迎广大编程爱好者加入![/free]
搜索更多相关主题的帖子: 魔兽密 效果 数字 系统 
2008-06-17 09:05
雪雨星风
Rank: 1
来 自:北京
等 级:新手上路
威 望:1
帖 子:566
专家分:0
注 册:2007-10-11
收藏
得分:0 
我说的有哪点不清楚吗?

C#发烧友QQ群1:5953354   QQ群2:68096127  QQ群3:30217249  QQ群4:37023079   为了更好方便大家交流学习,请不要重复加群
2008-06-17 10:18
雪雨星风
Rank: 1
来 自:北京
等 级:新手上路
威 望:1
帖 子:566
专家分:0
注 册:2007-10-11
收藏
得分:0 
摆脱   高手们指点一下

C#发烧友QQ群1:5953354   QQ群2:68096127  QQ群3:30217249  QQ群4:37023079   为了更好方便大家交流学习,请不要重复加群
2008-06-17 12:00
雪雨星风
Rank: 1
来 自:北京
等 级:新手上路
威 望:1
帖 子:566
专家分:0
注 册:2007-10-11
收藏
得分:0 
最上面不是有一行字母吗
左边也有列字母
要想找到唯一的数字必须根据横坐标和纵坐标找交叉点吧
产生的字母是先根据横坐标(也就是行)和纵坐标(也就是列)产生的
比如产生的ED  意思就是先在行上找到E再在列上找到D 他们相交的那个数就是要验证的数 57

C#发烧友QQ群1:5953354   QQ群2:68096127  QQ群3:30217249  QQ群4:37023079   为了更好方便大家交流学习,请不要重复加群
2008-06-17 12:56
airfei
Rank: 1
等 级:新手上路
帖 子:137
专家分:0
注 册:2007-4-12
收藏
得分:0 
这个简单呀,上面二维数组存放就不多说了。
你用随机产生的6位字母作为拆分,如AEBDHF,AE BD HF,
又因为你的A是列,E是行,
然后利用二重循环,查找。
唯一不同的是二维数组是比如a[5][1],这时你可以定义一个枚举变量来保存
A-Z。这样的话就可以查值了
比如a[5][1],可以用a[e.e][e.a]来代替,明白了吧
2008-06-18 11:47
雪雨星风
Rank: 1
来 自:北京
等 级:新手上路
威 望:1
帖 子:566
专家分:0
注 册:2007-10-11
收藏
得分:0 
//问题描述
//有时间正确  有时间取不到随即数 有时间数组索引超出范围   竟然能取到z  我实在看不出来   请高手帮助
//
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;  //动态数组命名空间
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        yanzheng();
        Response.Write("<meta http-equiv='refresh' content='30;URL=Default.aspx' /> ");  //30秒后自动刷新页面        
    }
    protected void tijiao_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.shuru.Text == "")
            {
                Response.Write("<script language=javascript>window.alert('请输入验证码!')</script>");
            }
            else
            {               
                if (this.shuru.Text == Session["yzm"].ToString())
                {
                    this.jieguo.Text = "你终于成功了";
                }
                else
                {
                    this.jieguo.Text = "你失败了";
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
    //通过二维数组产生验证码
    public void yanzheng()
    {
        string[,] myArray;      // 创建数组
        myArray = new string[,] { {"Z","A","B","C","D","E","F","G","H","I"},              //填充数组
                                   {"A","11","32","33","54","55","76","77","98","99"},
                                   {"B","12","31","34","53","56","75","78","97","01"},
                                   {"C","13","30","35","52","57","74","79","96","02"},
                                   {"D","14","29","36","51","58","73","80","95","03"},
                                   {"E","15","28","37","50","59","72","81","94","04"},
                                   {"F","16","27","38","49","60","71","82","93","05"},
                                   {"G","17","26","39","48","61","70","83","92","06"},
                                   {"H","18","25","40","47","62","69","84","91","07"},
                                   {"I","19","24","41","46","63","68","85","90","08"},
                                   {"J","20","23","42","45","64","67","86","89","09"},
                                   {"K","21","22","43","44","65","66","87","88","10"}};
        try
        {
            for (int x = 0; x < 12; x++)       //输出数组  (方便测试)
            {
                for (int y = 0; y < 10; y++)
                {
                    Response.Write(myArray[x, y] + "  ");
                }
                Response.Write("<br>");
            }
            //输出字母索引行
            for (int j = 0; j < 10; j++)
            {
                Response.Write("列:" + myArray[0, j] + "  ");
            }
            //字输出母索引列
            Response.Write("<br>");
            for (int j = 0; j < 12; j++)
            {
                Response.Write("行:" + myArray[j, 0] + "  ");
            }
            Random rdm = new Random();       // 实例化一个生成器
            for (int x = 0; x < 12; x++)
            {
                for (int y = 0; y < 10; y++)
                {
                    if (myArray[x, y] == myArray[rdm.Next(1, 12), rdm.Next(1, 10)])
                    {
                        Response.Write(myArray[x, 0]);    //测试输出用
                        Response.Write(myArray[0, y]);
                        Response.Write("<br>");
                        Response.Write(x);
                        Response.Write(y);
                        Response.Write("<br>");
                        Response.Write(myArray[y, x]);
                        Session["lie"] = myArray[x, 0];  // 产生行字母
                        Session["hang"] = myArray[0, y]; //产生列字母
                        Session["yzm"] = myArray[y, x];  //产生行和列坐标交叉点的数字
                    }
                }
                Response.Write("<br>");
            }
            Response.Write("<br>");
            this.xianshi.Text = Session["lie"].ToString();
            this.xianshi.Text += Session["hang"].ToString();      //给显示验证码的label赋值     
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
}

C#发烧友QQ群1:5953354   QQ群2:68096127  QQ群3:30217249  QQ群4:37023079   为了更好方便大家交流学习,请不要重复加群
2008-06-18 12:01
快速回复:魔兽密保卡效果,精通数组的大虾请进!
数据加载中...
 
   



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

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