MIPS 输入获取

发布于 2024-10-09 07:44:18 字数 31 浏览 0 评论 0原文

如何在 mips 的 main 函数中获取输入?

How to take input in main function in mips?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们只是彼此的过ke 2024-10-16 07:44:18

这取决于。如果你要要求一个整数,它应该是

li $v0, 5
syscall

如果你要要求一个浮点数,它应该是

li $v0, 6
syscall

如果你要要求一个双精度数,它应该是

li $v0, 7
syscall

如果你要要求一个字符串,它应该是

li $v0, 8
syscall

但是,如果您要请求一个字符串并且输入将占用最大字符数,那么在打印它时您应该使用 $a1 而不是 $a0

It depends. If you are going to ask for an integer it should be

li $v0, 5
syscall

If you are going to ask for a float should be

li $v0, 6
syscall

If you are going to ask for a double it should be

li $v0, 7
syscall

And if you are going to ask for an string it should be

li $v0, 8
syscall

But, if you are going to ask for an string and the input is going to take maximum number of characters, then you should use $a1instead of $a0 when printing it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文