小编Eri*_*ney的帖子

汇编MIPS - 如何将用户的整数存储到内存中?

所以,我不知道装配是如何工作的,也不知道我在做什么.我以为我做了,但当然我错了.所以这是我的问题 - 我甚至不知道如何让用户输入一个整数,所以我可以将它存储在内存中.我也不知道我的变量是否对齐,因为我甚至不理解"对齐"究竟是什么.下面是我的汇编代码,以及显示我想要代码执行的内容的注释.请帮忙

.data
                    # variables here

intPrompt:                  .asciiz "\nPlease enter an integer.\n"
stringPrompt:               .asciiz "\nPlease enter a string that is less than 36 (35 or less) characters long.\n"
charPrompt:                 .asciiz "\nPlease enter a single character.\n"
int:                    .space 4
string:                     .space 36
char:                   .byte  1







                    .text
                    .globl main
main:

                    # print the first prompt
                    li $v0, 4
                    la $a0, intPrompt
                    syscall


                    # allow user to enter an integer
                    li $v0, 5
                    syscall

                    # store the input in `int`
                    # don't …
Run Code Online (Sandbox Code Playgroud)

assembly mips spim mips32

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

如何在C中为AVR-Studio编写自定义reset()函数?

所以我被分配了为AVR编译编写自定义reset()函数的任务.

我得到了这个信息 - "Atmega128和Pic24e在程序地址0x0处有复位中断.写一个函数reset()来复位程序.我也听说过强制系统重启的一种简单方法就是发送它进入无限循环.

叫我疯了,但这就像写作一样简单:

function reset(){
  goto 0x00000000;
}
Run Code Online (Sandbox Code Playgroud)

不确定你是否可以这样做,而不是寻找复杂的解释,因为我很确定这是一个通用的问题.简短而甜蜜,如果你能:)

c gcc avr avr-gcc

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

有没有办法让页面的隐藏内容滑入页面?jQuery/JavaScript

基本上,这就是我想要做的.我有内容,表单,页面底部,显示设置为无.我想要做的是,当有人点击向上箭头时,图像图标,整个表单将向上滑动到视图中,并变得可见,而如果他们再次单击箭头,它将返回表单以向下滑动将其显示设置为无.这就是我到目前为止所拥有的.

<div class="hidden_panel_wrapper">
<div class="hidden_panel_icon"> <img id="hidden_panel_icon" src="thumbnails/up_arrow.png"> </div>
<div class="hidden_panel hide" id="hidden_panel">
<div class="hidden_panel_form">
<form name="newsletter_subscribe" method="post" action="subscribe_success.php">
<input class="text_input" type="email" placeholder="Type E-Mail Address" name="email">
<input type="submit" class="button_input" value="Subscribe To Our Newsletter">
</form>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)

所以我知道要使用幻灯片切换,slidedown会将元素带入视图,但我无法弄清楚如何滑动并将元素带入视图.我环顾了jquery animate,无法理解它,我也只是通过javascript(object.style.top =" - 200px"来设置新样式,但这并没有真正起作用.简单来说,我需要一个slidetoggle,但是我的内容会向上滑动到视图中,然后DOWN返回display ="none".提前感谢!

html javascript jquery

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

调用getline()没有匹配函数?

每次我尝试构建此代码时都会出错,

"没有用于调用getline()的匹配函数"

但我以前用过它并且工作正常吗?我不确定发生了什么事.我正在使用Mavericks OSX,如果有的话,并使用Xcode来构建这个项目.这是为了学校.我知道inputFile工作正常,因为我已经注释了打印到控制台的getline()和"Open".

//
//  main.cpp
//  Project 4
//
//  Created by Eric Diviney on 10/27/13.
//  Copyright (c) 2013 Eric Diviney. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
    /*
    |
    |-------------------------------------------------------------
    |   Documentation
    |-------------------------------------------------------------
    |   The headings[] array will contain all strings for the customer's receipt.
    |   the 2nd level of headings[][] will contain all of the info (name, address etc.) while
    |   the first level …
Run Code Online (Sandbox Code Playgroud)

c++ macos getline

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

程序不会在 exit() 函数之前打印行吗?

我有一个用 C++ 编写的学校小项目,我们必须解决一些错误,并在发生错误时退出程序。基本上,在 else 语句中,当表达式被评估为 false 时,就好像它不会将错误写入文件。如果我将它输出到控制台(通过 cout)而不是将其写入文件,它工作得很好,但是当我尝试将它写入输出文件时,它不起作用。基本上,这就是我的问题。我的教授要求所有输出都写入文件,这就是我不能使用 cout 的原因。那么为什么它会将其输出到控制台,而不是文件呢?

PS 我正在将其他内容输出到文件中,并且工作正常,因此为了记录,我认为它已缩小到 else 语句中的小代码块。

if(tempUnit == 'C' || tempUnit == 'F')
    {
      if(tempUnit == 'F')
      {
        temp = convertTemp(temp, tempUnit);
      }

      temps[a] = temp;

      printTemp(outputFile, tempUnit, temp);
      printTimestamp(outputFile, humanDate);

      outputFile << endl;

    }
    else{
      // this is where it doesnt work
      outputFile << "Error. Incorrect temperature unit, must be " << 
      "either a capital C or a capital F. Program ended.";
      exit(0);
    }
Run Code Online (Sandbox Code Playgroud)

c++ fstream iostream

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

为什么我在此代码中获得未捕获的异常?

所以在我下面的代码中,我不确定我哪里出错了.语法使用不当,错误使用变量?请帮忙!

出于某种原因,我在浏览器中运行它并返回

"Fatal error: Uncaught exception 'numexception' with message 'The numbers are not set' in C:\xampp\htdocs\php_testing\test.php:29 Stack trace: #0 {main} thrown in C:\xampp\htdocs\php_testing\test.php on line 29".

我不明白我的代码哪里出错了???

class numexception extends Exception{}

function multiply($a,$b){
     echo $a*$b;
}


$var1 = 5;
//$var2 = 2; as you can see variable 2 is not set as I commented it out to test
//the exception

if(!isset($var1) or !isset($var2)){
  throw new numexception("The numbers are not set");
}

try{
    multiply($var1,$var2);
}
catch(numexception $e){
    echo "This exception …
Run Code Online (Sandbox Code Playgroud)

php exception try-catch

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

是否执行了throw()和catch()之间的代码?

好的,所以我是错误处理的新手,我已经看到了一些例子,但我还没有看到这个问题的答案.我将使用一些真正的基本示例代码来显示我在问什么.

if(some condition){
    throw Exception()
  }

  //Some random code in between
  echo "Code between throw() and Catch()";

catch(Exception $e){
//handle the caught exception
}
Run Code Online (Sandbox Code Playgroud)

所以基本上,我的问题是 - 如果if()中的条件导致抛出异常,随机echo语句会执行,还是会跳过并直接进入异常的catch()?

php try-catch throw

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

标签 统计

c++ ×2

php ×2

try-catch ×2

assembly ×1

avr ×1

avr-gcc ×1

c ×1

exception ×1

fstream ×1

gcc ×1

getline ×1

html ×1

iostream ×1

javascript ×1

jquery ×1

macos ×1

mips ×1

mips32 ×1

spim ×1

throw ×1