我正在使用tasm编写程序集.我的任务是编写一个程序,使用冒泡排序按字母顺序对输入的字符串进行排序.防爆.如果你输入"你好",它应该写"ehllo".我已经写了乞求输入字符串并对它进行排序(我认为它工作直到它应该打印出结果的结尾,但最后它只是写了我的.data一次并完成它的工作)PS对不起英语
.model small
.stack 100h
.data
request db 'This program is using bubblesort to get alphabetical order of your enterd string', 0Dh, 0Ah, 'Enter your string:', 0Dh, 0Ah, '$'
result db 0Dh, 0Ah, 'Result:', 0Dh, 0Ah, '$'
buffer db 100, ?, 100 dup (0)
.code
start:
MOV ax, @data
MOV ds, ax
MOV ah, 09h
MOV dx, offset request
int 21h
MOV dx, offset buffer
MOV ah, 0Ah
INT 21h
MOV si, offset buffer
INC si
MOV bh, [si]
INC …Run Code Online (Sandbox Code Playgroud) 刚开始使用 webpack-2,有一个关于全局函数的问题。在名为 js 的文件中有这些函数showPictures.js:
function isEmpty(el) {
var result = !$.trim(el.html());
return result;
}
function showPicturesList() {
if (!isEmpty($('#picture-name-list'))) {
var pictureList = document.getElementById("added-pictures");
pictureList.style.visibility = 'visible';
}
}
Run Code Online (Sandbox Code Playgroud)
我util.js在女巫中有另一个文件我正在调用showPicturesList()函数
window.onload = function(){
showPictureList();
}
Run Code Online (Sandbox Code Playgroud)
简单地使用 js 我会将两个脚本导入到我的 html 中,但是使用 webpack 我可以为它们创建一个文件,所以webpack.config.js我将这两个文件添加为entry数组。我的输出文件bundle.js看起来应该包含这两个文件。问题是对 js 文件进行最少更改以showPictureList()从utils.js文件调用函数的最简单方法是什么?
我正在尝试为我创建的列表类型创建一个Eq实例.只有当两个列表平均值相等时,Eq才会返回true.
average :: (Real a, Fractional b) => [a] -> b
average xs
| xs == [] = 0
| otherwise = realToFrac (sum xs) / genericLength xs
data NumList a = Nlist [a]
instance Eq (NumList a) where
(Nlist x) == (Nlist y) = (average x) == (average y)`
Run Code Online (Sandbox Code Playgroud)
但是当我尝试编译这个时,我得到错误:
No instance for (Real a) arising from a use of ‘average’
Possible fix:
add (Real a) to the context of the instance declaration
In the first argument of ‘(==)’, …Run Code Online (Sandbox Code Playgroud)