demo_factorial

所属分类:collect
开发工具:Dockerfile
文件大小:0KB
下载次数:0
上传日期:2022-05-07 14:36:27
上 传 者sh-1993
说明:  不同编程语言中的演示阶乘计算应用程序
(Demo factorial calculation app in different programming languages)

文件列表:
Makefile (578, 2022-05-07)
assembler/ (0, 2022-05-07)
assembler/Dockerfile (532, 2022-05-07)
assembler/main.asm (861, 2022-05-07)
bash/ (0, 2022-05-07)
bash/Dockerfile (149, 2022-05-07)
bash/main.sh (885, 2022-05-07)
cpp/ (0, 2022-05-07)
cpp/Dockerfile (193, 2022-05-07)
cpp/main.cpp (992, 2022-05-07)
cs/ (0, 2022-05-07)
cs/.dockerignore (11, 2022-05-07)
cs/Dockerfile (391, 2022-05-07)
cs/main.cs (785, 2022-05-07)
cs/main.csproj (226, 2022-05-07)
dart/ (0, 2022-05-07)
dart/.dockerignore (11, 2022-05-07)
dart/Dockerfile (333, 2022-05-07)
dart/main.dart (849, 2022-05-07)
go/ (0, 2022-05-07)
go/Dockerfile (402, 2022-05-07)
go/main.go (846, 2022-05-07)
haskell/ (0, 2022-05-07)
haskell/Dockerfile (275, 2022-05-07)
haskell/main.hs (668, 2022-05-07)
java/ (0, 2022-05-07)
java/Dockerfile (193, 2022-05-07)
java/main.java (1010, 2022-05-07)
javascript/ (0, 2022-05-07)
javascript/Dockerfile (201, 2022-05-07)
javascript/main.js (1145, 2022-05-07)
kotlin/ (0, 2022-05-07)
kotlin/Dockerfile (335, 2022-05-07)
kotlin/main.kt (784, 2022-05-07)
php/ (0, 2022-05-07)
php/Dockerfile (167, 2022-05-07)
php/main.php (803, 2022-05-07)
python/ (0, 2022-05-07)
... ...

# Demo Application to calculate [Factorial](https://en.wikipedia.org/wiki/Factorial) in Various Programming Languages ## Program Objective To calculate the [factorial](https://en.wikipedia.org/wiki/Factorial) value given the user's input from STDIN. The result is being output to STDOUT. ### Program Architecture ```bash Cycle: └──> Input interface (STDIN) └──> Core logic └──> Output interface (STDOUT) ``` ## How to Run Run to see the list of options for programs executions (requires [GNU make](https://www.gnu.org/software/make/)): ```bash make help ``` Run to execute the programs ([docker](https://www.docker.com/) is required): ```bash make run LANG=##SPECIFY_THE_LANGUAGE## ``` For example to execute a golang program, run: ```bash make run LANG=go ``` ## List of Languages |Language|Codebase|[Stackoverflow Popularity](https://insights.stackoverflow.com/survey/2021#section-most-popular-technologies-programming-scripting-and-markup-languages) [%]| |-|-|-:| |[javascript](https://www.javascript.com/)|[code](./javascript/main.js)|64.96| |[python](https://www.python.org/)|[code](./python/main.py)|48.24| |[java](https://www.java.com/)|[code](./java/main.java)|35.35| |[bash/shell](https://www.gnu.org/software/bash/)|[code](./bash/main.sh)|27.13| |[C++](https://www.cplusplus.com/)|[code](./cpp/main.cpp)|24.31| |[php](https://www.php.net/)|[code](./php/main.php)|21.98| |[go](https://golang.org/)|[code](./go/main.go)|9.55| |[kotlin](https://kotlinlang.org/)|[code](./kotlin/main.kt)|8.32| |[rust](https://www.rust-lang.org/)|[code](./rust/main.rs)|7.03| |[ruby](https://www.ruby-lang.org/en/)|[code](./ruby/main.rb)|6.75| |[dart](https://dart.dev/)|[code](./dart/main.dart)|6.02| |[haskell](https://www.haskell.org/)|[code](./haskell/main.hs)|2.12| ## Lines of Code Run to analyse LoC (requires [cloc](https://github.com/AlDanial/cloc)): ```bash cloc . --exclude-lang=Dockerfile,make,Markdown ``` ```bash ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C++ 1 5 4 48 Bourne Shell 1 4 4 39 Go 1 5 4 39 PHP 1 4 4 39 JavaScript 1 5 4 38 Rust 1 4 4 34 Dart 1 4 4 33 Ruby 1 4 4 32 Java 1 5 4 28 Kotlin 1 3 4 27 Python 1 15 12 21 Haskell 1 5 4 18 ------------------------------------------------------------------------------- SUM: 12 63 56 396 ------------------------------------------------------------------------------- ``` It can be noticed from the table, that `haskell` requires the least amount of expressions/code to solve the problem, `C++` on the other hand, requires the most amount of code among all compared languages. The figure for `python` is another confirmation of why the language is so popular among the community members - it's very easy to express your solution in a few lines of code. And it's not only that, the expressions are very human-readable.

近期下载者

相关文件


收藏者