Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
&引用;MIPS";0x0040003c处的运行时异常:字边界上的提取地址未对齐0x10010005错误 C++版本 #包括 使用名称空间std; int x[10]={0}; int pos[6]={1,3,6,9,-1,-1}; int数据[_C++_Mips_Sql Server Mars - Fatal编程技术网

&引用;MIPS";0x0040003c处的运行时异常:字边界上的提取地址未对齐0x10010005错误 C++版本 #包括 使用名称空间std; int x[10]={0}; int pos[6]={1,3,6,9,-1,-1}; int数据[

&引用;MIPS";0x0040003c处的运行时异常:字边界上的提取地址未对齐0x10010005错误 C++版本 #包括 使用名称空间std; int x[10]={0}; int pos[6]={1,3,6,9,-1,-1}; int数据[,c++,mips,sql-server-mars,C++,Mips,Sql Server Mars,&引用;MIPS";0x0040003c处的运行时异常:字边界上的提取地址未对齐0x10010005错误 C++版本 #包括 使用名称空间std; int x[10]={0}; int pos[6]={1,3,6,9,-1,-1}; int数据[6]={73,47,23,26,-1,-1}; int main(){ 对于(int i=0;i=0){ 内部温度=位置[i]; x[temp]=数据[i]; } } 对于(inti=0;iinttemp=pos[i]pos内部是什么?intp

&引用;MIPS";0x0040003c处的运行时异常:字边界上的提取地址未对齐0x10010005错误 <代码> C++版本 #包括 使用名称空间std; int x[10]={0};
int pos[6]={1,3,6,9,-1,-1}; int数据[6]={73,47,23,26,-1,-1}; int main(){ 对于(int i=0;i=0){ 内部温度=位置[i]; x[temp]=数据[i]; } }
对于(inti=0;i
inttemp=pos[i]
pos内部是什么?intpos[6]={1,3,6,9,-1,-1};int data[6]={73,47,23,26,-1,-1};您还可以将您的代码作为问题的编辑发布:使其更易于阅读XD。那么:当使用
x[-1]
x[9]时,您希望得到哪个值
?预期的输出应该是0,73,0,47,0,0,23,0,0,26,啊,我的错;错过了
=0
部分
int-temp=pos[i]
pos[6]里面是什么?int-pos[6]={1,3,6,9,-1,-1};int-data[6]={73,47,23,26,-1};您也可以将您的代码作为编辑发布在您的问题上:使其更易于阅读XD。那么:使用
x[-1]
x[9]
时,您希望得到哪个值?预期的输出应该是0、73、0、47、0、0、23、0、0、26,啊,我的错;错过了
=0
部分
 the C++ version is

 #include <iostream>
 using namespace std;

 int x[10] = {0};
 int pos[6] = {1, 3, 6, 9, -1, -1};
 int data[6] = {73, 47, 23, 26, -1, -1};
 int main() {

 for (int i=0; i<6; i++) {
  if (pos[i] >= 0) {
    int temp = pos[i];
    x[temp] = data[i];
  }
}

  for (int i=0; i<10; i++) {
  cout << x[i] << endl;
}
     .data
 x: .word   0:10
 pos:   .word   1
    .word   3
    .word   6
    .word   9
    .word   -1
    .word   -1
data:   .word   73
    .word   47
    .word   23
    .word   26
    .word   -1
    .word   -1

endl:   .asciiz "\n"

# i     $s0
# &x[0]     $s1
# &pos[0]   $s2
# &data[0]  $s3
# 6, 10     $s6

    .text
main:   la  $s1, x
    la  $s2, pos
    la  $s3, data
    li  $s6, 6
    li      $s0, 0          #  for (int i=0; i<6; i++) {
for:    mul $t0,$s0,4       #    if (pos[i] >= 0) {
    add     $t0,$s2,$s0
    lw  $t1,($t0)
    blt     $t1,0,loop


    add  $t2, $s1,$t1    # int temp = pos[i]        
    lw   $t3,4($t2)             #      x[temp] = data[i];   
    add  $t4, $s3,$s0
    lw   $t5, 4($t4)
    sw   $t3, ($t5)

loop:  addi $s0, $s0,1          #    }
    blt $s0, $s6, for           #  }