小编Bra*_*ble的帖子

你能在"if"语句中执行多个语句吗?

这是我的功能:

(defun MyFunction(input)
  (let ((NEWNUM (find input num)))
    (if (find input num)              //if this 
      (setq num NEWNUM) (FUNCT2)      //then execute both of these
    (list 'not found))))              //else output this
Run Code Online (Sandbox Code Playgroud)

所以在if声明之后我希望能够执行,(setq num NEWNUM)然后(FUNCT2)设置一个新变量,然后调用一个函数.关于如何做到这一点的任何想法?

lisp

25
推荐指数
3
解决办法
2万
查看次数

C#字符串浮动?

我在这里有一些代码:

int i = 0;

        StreamReader re = File.OpenText("TextFile1.txt");
        string input = null;

        while ((input = re.ReadLine()) != null)
        {
            string[] sites = input.Split(' ');
            for (int j = 0; j < sites.Length; j++)
            {
                MyArray[i, j] = Convert.ToInt32(sites[j]);
            }
            i++;
        }


     for (int a = 0; a < 5; a++)
     {
            for (int j = 0; j < 5; j++)
            {
                Console.Write(MyArray[a, j] + " ");

            }
            Console.WriteLine();
     }
Run Code Online (Sandbox Code Playgroud)

我的问题是这行代码

MyArray[i, j] = Convert.ToInt32(sites[j]);
Run Code Online (Sandbox Code Playgroud)

它被转换为int,如何将其转换为浮点数?

c#

9
推荐指数
3
解决办法
6万
查看次数

你如何在Prolog中做一个嵌套的if-else语句?

如果我有这个功能:

min(List1, List2, Output) :-
   length(List1, N),
   length(List2, M),
   (   N < M ->
       Output = 'true'
   ;   Output = 'false'
   ).
Run Code Online (Sandbox Code Playgroud)

但如果我还想检查N == M怎么办?也许是这样的:

min(List1, List2, Output) :-
   length(List1, N),
   length(List2, M),
   (   N < M ->
       Output = 'true'
   ;   (  N = M ->
          Output = 'equal'
       ;  Output = 'other'
       )
   ).
Run Code Online (Sandbox Code Playgroud)

似乎没有用.

prolog

8
推荐指数
2
解决办法
1万
查看次数

无符号整数到BCD转换?

我知道你可以使用这个表将十进制转换为BCD:

0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001

是否存在此转换的等式或您只需使用该表?我试图为这个转换写一些代码,但我不知道如何为它做数学.建议?

c++ bcd

7
推荐指数
4
解决办法
4万
查看次数

uibutton发件人标签

我有一个UIImageView对象,单击它时会播放动画,我想重用相同的代码来制作多个对象.如何设置发件人标签以使其知道其不同的对象?

.H

- (IBAction)startClick:(id)sender;
Run Code Online (Sandbox Code Playgroud)

.M

- (IBAction)startClick:(id)sender
{
    //UIImageView *theButton = (UIImageView *)sender.tag;

    bubble.animationImages = [NSArray arrayWithObjects:
                           [UIImage imageNamed: @"Pop_1.png"],
                           [UIImage imageNamed: @"Pop_2.png"],
                           [UIImage imageNamed: @"Pop_3.png"], nil];

    [bubble setAnimationRepeatCount:1];
    bubble.animationDuration = 1;
    [bubble startAnimating];
}
Run Code Online (Sandbox Code Playgroud)

iphone xcode

4
推荐指数
1
解决办法
2万
查看次数

在Visual Studio 2008中创建.exe

任何人都可以善良,并告诉我如何在visual studio 2008中为基于win32控制台的c ++程序制作一个exe文件?谢谢

c++ visual-studio-2008 visual-studio

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

你如何搜索地图?

我有一张地图:

Map<String, String> ht = new HashMap();
Run Code Online (Sandbox Code Playgroud)

我想知道如何搜索它并找到与特定字符串匹配的任何内容.如果它是匹配存储它成为arraylist.地图包含这样的字符串:

1,2,3,4,5,5,5

匹配的字符串为5.

所以我有这个:

  String match = "5";
  ArrayList<String> result = new ArrayList<String>();

 Enumeration num= ht.keys();
     while (num.hasMoreElements()) {
        String number = (String) num.nextElement();

        if(number.equals(match))
        {
           result.add(number);
        }

     }
Run Code Online (Sandbox Code Playgroud)

java

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

枚举可以表示字符串数字吗?

我希望用户输入"Sun"并将其表示为"1".

Console.Write("Enter a Day: ");
day = Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)

可以这样做吗?

c#

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

如何写入资源文件?

如果可以从源文件中读取,如下所示:

string fileContent = Resources.Users;

using (var reader = new StringReader(fileContent))
{
    string line;
    while ((line = reader.ReadLine()) != null)
    {
        string[] split = line.Split('|');
        string name = split[0];
        string last = split[1];

    }
}
Run Code Online (Sandbox Code Playgroud)

那你怎么写同一个文件?

c# file embedded-resource

3
推荐指数
1
解决办法
2万
查看次数

如何在纯css导航栏上获得三角形悬停效果?

当用户将鼠标悬停在不同的标签上时,我希望文本下方有一个小三角形.这是我正在使用的一些代码.

css navbar

html css css-shapes

3
推荐指数
1
解决办法
2万
查看次数