简易Rust加法计算器
Tofloor
poster avatar
hzqelf
deepin
2020-03-02 10:09
Author
一个简单的命令行加法计算器:

如图所示,您可以对整数和小数进行求和运算,而不用敲出“+”号(这个符号在没有小数字键盘的笔记本电脑上不方便敲出,进行连续加法运算较为不便,这个小程序允许您直接用空格代替“+”号)。您可以把文件解压到/bin目录下,这样就能直接使用了。

该程序用Rust编程语言编写,源码如下(欢迎提建议):

我自己的电脑目前是LinuxMint19.2,如果deepin或其他Linux发行版无法运行,欢迎提供反馈。

Reply Favorite View the author
All Replies
avatar
hzqelf
deepin
2020-03-05 05:06
#1
更新一下代码风格,由命令式变为函数式:

Reply View the author
avatar
ritter
deepin
2020-03-05 13:47
#2
Rust语法可太丑了。
Reply View the author
avatar
antantic
deepin
2020-03-05 15:49
#3
rust怎么学啊 这语言好难
Reply View the author
avatar
hzqelf
deepin
2020-03-06 04:10
#4
本帖最后由 hzqelf 于 2020-3-5 20:20 编辑
https://bbs.deepin.org/post/189361
Rust语法可太丑了。

Rust很美,你只是缺乏欣赏美的眼睛。
Reply View the author
avatar
hzqelf
deepin
2020-03-06 04:18
#5
https://bbs.deepin.org/post/189361
rust怎么学啊 这语言好难

其实,本来很简单的,不算main和大括号,3行就能搞定。我由于想搞函数式编程的链式调用就写了trait做扩展。原本是这样的:

Rust 简单,简洁,优雅;这才是真正的魅力。

Reply View the author
avatar
wait4me
deepin
2020-03-09 07:32
#6
说实话,很多人大概都是从c系语言培养的审美,c/c++,java,c#等
Reply View the author
avatar
luzhishen
deepin
2020-03-09 16:05
#7
https://bbs.deepin.org/post/189361
说实话,很多人大概都是从c系语言培养的审美,c/c++,java,c#等

确实如此
Reply View the author
avatar
海天鹰
deepin
2020-03-09 18:28
#8
真心不喜欢
Reply View the author
avatar
jmjoy
deepin
2020-03-09 18:46
#9
我是Rust爱好者,Rust到处都闪烁着PLT的光芒,这是一众千篇一律的旧语言和新语言不能比拟的,写Rust是一种享受的过程。

https://my.oschina.net/jmjoy/blog/3190024
https://my.oschina.net/jmjoy/blog/3187983
Reply View the author
avatar
孤城てす
deepin
2022-05-10 19:00
#10
ritter
Rust语法可太丑了。

审美不一样,就不要狗眼看人低了

Reply View the author
avatar
孤城てす
deepin
2022-06-17 21:40
#11
海天鹰
真心不喜欢

不需要你喜欢,地球没了你照样转

Reply View the author
avatar
btxhh
deepin
2022-08-14 07:04
#12

有没有人用 ArchLinux + vim + rust 这一套,属于是顶级装b套件了

对了,再配个二次元头像。

Reply View the author