小编Jen*_*ger的帖子

程序集x86:我必须编写Ackermann函数

我需要编写Ackermann函数.这是我到目前为止:

    .model small
;
    extrn   putstrng:far
    extrn   newline:far
    extrn   getdec$:far
    extrn   putdec$:far
; 
;
    .stack 1024                  
;
    .const


    .data

    .code
    assume ds:dgroup
;
debut:  mov     ax, seg dgroup     
    mov     ds, ax
    mov     es, ax
;

    mov     ax,2   ; value of N
    mov     bx,ax
    mov     ax,2 ; Value of M
    mov     dx,ax
    mov     cx,0

    push    dx
    push    bx

    call ackermann

    pop     bx
    pop     dx

    MOV ax, 0
    MOV ax, cx
call    putdec$
call    newline


    mov     ax, 4c00h          
    int     21h

ackermann   proc …
Run Code Online (Sandbox Code Playgroud)

x86 assembly

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

从循环返回值

无论如何我可以从循环返回一个值,因为递归必须在尾部

(ns for)

    (defn abc [y]
    (loop [x 10]
      (when (> x 2)
        (if (= 2 3) (do (println "test") (recur (- x 2)))
        (do (let [x (+ 1 x)
                  y 2] (println y) (recur (- x 2))))))))

    (abc 1)
Run Code Online (Sandbox Code Playgroud)

无论如何我可以通过将y作为参数并更新y的新值来返回函数的值.但是,recur部分必须位于代码的最后一行,因此我无法将y作为代码的最后一行.

(ns for)

    (defn abc [y]
    (loop [x 10]
      (when (> x 2)
        (if (= 2 3) (do (println "test") (recur (- x 2)))
        (do (let [x (+ 1 x)
                  y 2] (println y) (recur (- x 2)))))))
    y) …
Run Code Online (Sandbox Code Playgroud)

clojure

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

获取运行可执行文件的文件句柄

我试图在我自己的运行程序的可执行文件上调用GetFileInformationByHandle.这意味着我需要获取启动程序的.exe文件句柄.有没有办法做到这一点?

如果失败了,有没有办法获得正在运行的可执行文件的nFileIndexHigh和nFileIndexLow?

c c++ windows winapi

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

汇编编程和过程调用有问题

我正在使用MASM进行一些汇编编程.当我尝试运行我的程序时,它遇到"调用myFunction"时立即崩溃,即使我已经从程序中删除了所有代码.这是我的代码任何帮助将不胜感激.

    .486
    .model flat
    .stack 100h

    ExitProcess PROTO NEAR32 stdcall, dExitCode:DWORD

    .code
_start:

    call myFunction

    INVOKE ExitProcess,0
    PUBLIC _start

myFunction  proc  near32


myFunction  endp

END
Run Code Online (Sandbox Code Playgroud)

windows x86 assembly masm

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

生成可在任何地方加入的随机数

这是我的代码的开头:

 public partial class Form1 : Form
{
    static Random random = new Random();
    int prevnum;
    int currentnum;

    public int GenerateRandomNumber()
    {
        return random.Next(1, 1000);
    }
    public Form1()
    {
        int randomNumber = random.Next(1, 1000);
        InitializeComponent();

    }

    private void enterButton_Click(object sender, EventArgs e)
    {
        currentnum = Convert.ToInt32(guessBox.Text);

        if (randomNumber < currentnum)
        {
            warmOrColdLabel.Text = "Too High";

            if (currentnum > prevnum)
            {
                guessBox.BackColor = Color.Blue;
                prevnum = currentnum;
            }
            else
            {
                guessBox.BackColor = Color.Red;
                prevnum = currentnum;
            }
        }
        if (randomNumber > …
Run Code Online (Sandbox Code Playgroud)

c# random

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

从库中获取应用程序的版本号

我正在开发一个库,试图获取使用它的应用程序的版本号.

在我的测试应用程序中,当lib使用以下内容读取版本号时:

Assembly.GetExecutingAssembly().FullName;
Run Code Online (Sandbox Code Playgroud)

我得到的是lib的版本号,而不是主项目.

有没有一种简单的方法来查找主应用程序的版本号,而不是我的库中的版本号?

谢谢.

.net c# assemblies version windows-phone-7

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

C#smo项目程序集未引用错误

我正在做一个使用smo对象(服务器,数据库)的C#项目.
包括我

using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Server;  
Run Code Online (Sandbox Code Playgroud)

我添加了Microsoft.SqlServer.Management.Smo,Microsoft.SqlServer.Management.SmoExtended,Microsoft.SqlServer.SqlEnum,Microsoft.SqlServer.ConnectionInfo.

但我仍然得到这样的错误(10个错误类似于此):

The type 'Microsoft.SqlServer.Management.Sdk.Sfc.ISfcHasConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'.  
Run Code Online (Sandbox Code Playgroud)

怎么解决这个?

c# sql-server assemblies smo

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

WatiN引用了汇编错误

我正在尝试使这个基本的Watin控制台应用程序工作但是我遇到了以下错误:

"Warning    1   The referenced assembly "WatiN.Core" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.  consoletest"
Run Code Online (Sandbox Code Playgroud)

我已经确保将STAThread]属性应用于他们推荐的main方法.

下面是项目的屏幕截图:链接

附加说明:我安装了最新版本的watin(2.1),我设法得到一个类似的应用程序作为Windows类文件运行,但需要能够直接运行这个并看到输出,这就是为什么我正在制作一个Windows控制台应用.

任何帮助将不胜感激:)

c# console watin assemblies reference

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

16 位/32 位 x86

学习指南问题:不过,我不知道用 16 位和 32 位编写它有什么区别。有人可以澄清这如何改变事情吗?

编写一个 80x86 汇编程序,该程序将在内存中添加字大小的有符号整数,并在看到零时停止。总和将始终大于 -32768 且小于 32767。总和应写入内存。如果整数串中只有一个零,则总共放置一个 0。使用 JNZ 命令。(如果最后一个操作导致一个标签的零跳转。)

16 位整数 DW 2,-300, 54, 30, 8,,-240, 0 总 DW ?

32 位整数 WORD 2,-300, 54, 30, 8,,-240, 0 共 WORD ?

x86 assembly

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

获取列表中X个最大数字的索引

除了len()或range()之外,请不要内置插件.我正在读期末考试.

这是我的意思的一个例子.

def find_numbers(x, lst):


lst = [3, 8, 1, 2, 0, 4, 8, 5]

find_numbers(3, lst) # this should return -> (1, 6, 7)
Run Code Online (Sandbox Code Playgroud)

我没有完全尝试过这个......无法找出解决问题的最佳方法:

def find_K_highest(lst, k):
 newlst = [0] * k
 maxvalue = lst[0]


 for i in range(len(lst)):
    if lst[i] > maxvalue:
        maxvalue = lst[i]
        newlst[0] = i
Run Code Online (Sandbox Code Playgroud)

python algorithm

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