小编Bra*_*ble的帖子

联盟与地图?

我正在尝试联盟两套地图.我有两套,并希望将它们组合成第三套.我在push_back中遇到此代码的错误.有没有办法做到这一点?

map<char, vector<char> > numbers;
map<char, vector<char> >::iterator it;
numbers['E'].push_back('a');//set1
numbers['E'].push_back('b');
numbers['E'].push_back('c');
numbers['G'].push_back('d');//set2
numbers['G'].push_back('e');


void Create::Union(char set1, char set2, char set3)
{
    for (it = numbers.begin(); it != numbers.end(); ++it)
    {
        numbers[set3].push_back(it->second);
    }
}
Run Code Online (Sandbox Code Playgroud)

c++ stl

1
推荐指数
1
解决办法
3157
查看次数

C#中的多维数据结构

如何在C#中创建多维数据结构?

在我看来,它的工作原理如下:

 List<List<int>> results = new List<List<int>>();
    for (int i = 0; i < 10; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            results[i][j] = 0;
        }
    }
Run Code Online (Sandbox Code Playgroud)

这不起作用(抛出一个ArgumentOutOfRangeException).C#中是否存在多维结构,允许我通过索引访问成员?

.net c# data-structures

1
推荐指数
1
解决办法
972
查看次数

动态使用addEventListener?

我在flash中创建了一个导航栏,其中有5个不同的动画片段我用作按钮.每个动画片段(按钮)都有不同的实例名称.有没有办法使用addeventlistener,所以我不必像这样做:

//for button1
 button1.buttonMode = true;// Show the hand cursor
button1.addEventListener(MouseEvent.ROLL_OVER, button1_over);
button1.addEventListener(MouseEvent.ROLL_OUT, button1_out);
button1.addEventListener(MouseEvent.CLICK, button1_click);

function button1_over(e:MouseEvent):void
{
    e.currentTarget.gotoAndPlay("over");
}

function button1_out(e:MouseEvent):void
{
    e.currentTarget.gotoAndPlay("out");
}

function button1_click(e:MouseEvent):void
{
    var request:URLRequest = new URLRequest("http://website.com");
    navigateToURL(request);
}
//for button2
button2.buttonMode = true;// Show the hand cursor
    button2.addEventListener(MouseEvent.ROLL_OVER, button2_over);
    button2.addEventListener(MouseEvent.ROLL_OUT, button2_out);
    button2.addEventListener(MouseEvent.CLICK, button2_click);

    function button2_over(e:MouseEvent):void
    {
        e.currentTarget.gotoAndPlay("over");
    }

    function button2_out(e:MouseEvent):void
    {
        e.currentTarget.gotoAndPlay("out");
    }

    function button2_click(e:MouseEvent):void
    {
        var request:URLRequest = new URLRequest("http://website.com");
        navigateToURL(request);
    }
Run Code Online (Sandbox Code Playgroud)

...等所有五个按钮?

actionscript-3

1
推荐指数
1
解决办法
1222
查看次数

如何获取不同视图的触摸位置?

触摸可以指定self来获取其自己的坐标系中的触摸位置,但我如何从另一个获取它?说另一个UIview的坐标系?

   - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [UIView beginAnimations:@"box" context:nil];
    [UIView setAnimationDuration:1];
    [UIView setAnimationBeginsFromCurrentState:YES];
    UITouch *touch = [touches anyObject];
    box.center = [touch locationInView:self];
    [UIView commitAnimations];
}
Run Code Online (Sandbox Code Playgroud)

我可以用不同的UIview名称来看待"自我"吗?

iphone cocoa-touch touch

0
推荐指数
1
解决办法
2242
查看次数

你如何将矩阵乘以?

这是我到目前为止,但我不认为这是对的.

for (int i = 0 ; i < 5; i++)
{
    for (int j = 0;  j < 5; j++)
    {
        matrix[i][j] += matrix[i][j] * matrix[i][j];
    }
}
Run Code Online (Sandbox Code Playgroud)

c++ matrix matrix-multiplication

0
推荐指数
3
解决办法
4862
查看次数

C#列表清单?

如果我有这个:

List<List<int>> matrix = new List<List<int>>();
Run Code Online (Sandbox Code Playgroud)

我将如何填充它,使它看起来像这样:

0 0 0 0 0 0 0 

0 0 0 0 0 0 0

0 0 0 0 0 0 0

c#

0
推荐指数
2
解决办法
1969
查看次数

如何用","拆分文本,并在java中删除","?

我想拆分并删除这样输入文本字段的字符串中的逗号:

1,2,3,4,5,6

然后将它们显示在不同的文本字段中,如下所示:

123456

这是我尝试过的.

   String text = jTextField1.getText();

    String[] tokens = text.split(",");
    jTextField3.setText(tokens.toString());
Run Code Online (Sandbox Code Playgroud)

java

0
推荐指数
2
解决办法
124
查看次数

从字符串获取电子邮件

可能重复:
如何使用perl从字符串中提取电子邮件地址?

说我有这样的字符串:

X大学博士在无处的名字pete@school.edu Blah blah 3 one niner

我怎样才能收到那封电子邮件?

perl

0
推荐指数
1
解决办法
483
查看次数

如何获取HTML标签?

说我有这样的文本文件:

<html><head>Headline<html><head>more words
</script>even more words</script>
<html><head>Headline<html><head>more words
</script>even more words</script>
Run Code Online (Sandbox Code Playgroud)

我如何将标签放入如下列表中:

<html>
<head>
<html>
<head>
</script>
</script>
<html>
<head>
<html>
<head>
</script>
</script>
Run Code Online (Sandbox Code Playgroud)

python

0
推荐指数
1
解决办法
6107
查看次数