Skip to content

Commit 4a48092

Browse files
committed
Adding c, ooc, and scala implementations
1 parent 6e6dcaf commit 4a48092

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ This ASCII representation is a cartoon mascot at [Cerner Engineering](http://eng
4141
### Languages
4242
* [bash](https://www.gnu.org/software/bash/manual/) - [art.sh](bash/art.sh) (`bash art.sh`)
4343
* [clojure](http://clojure.org/) - [art.clj](clojure/art.clj) (`java -cp clojure.jar clojure.main art.clj`)
44+
* [c](http://en.wikipedia.org/wiki/C_(programming_language)) - [art.c](c/art.c) (`gcc art.c -o art && ./art`)
4445
* [coffeescript](http://coffeescript.org/) - [art.coffee](coffeescript/art.coffee) (`coffee art.coffee`)
4546
* [d](http://dlang.org/) - [art.d](d/art.d) (`rdmd art.d`)
4647
* [dart](https://www.dartlang.org/) - [art.dart](dart/art.dart) (`dart art.dart`)
@@ -53,9 +54,11 @@ This ASCII representation is a cartoon mascot at [Cerner Engineering](http://eng
5354
* [julia](http://julialang.org/) - [art.jl](julia/art.jl) (`julia art.jl`)
5455
* [lua](http://www.lua.org/) - [art.lua](lua/art.lua) (`lua art.lua`)
5556
* [ocaml](https://ocaml.org) - [art.ml](ocaml/art.ml) (`ocaml art.ml`)
57+
* [ooc](http://ooc-lang.org/) - [art.ooc](ooc/art.ooc) (`rock art.ooc && ./art`)
5658
* [node.js](http://nodejs.org/) - [art.js](node/art.js) (`node art.js`)
5759
* [python](https://docs.python.org/3/) - [art.py](python/art.py) (`python art.py`)
5860
* [r](http://www.r-project.org/) - [art.r](r/art.r) (`Rscript art.r`)
5961
* [rebol](http://www.rebol.com/) - [art.r](rebol/art.r) (`rebol art.r`)
6062
* [ruby](https://www.ruby-lang.org/en/) - [art.rb](ruby/art.rb) (`ruby art.rb`)
61-
* [rust](http://www.rust-lang.org/) - [art.rs](rust/art.rs) (`rustc art.rs && ./art`)
63+
* [rust](http://www.rust-lang.org/) - [art.rs](rust/art.rs) (`rustc art.rs && ./art`)
64+
* [scala](http://www.scala-lang.org/) - [Art.scala](scala/Art.scala) (`scalac Art.scala && scala Art`)

c/art.c

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <stdio.h>
2+
3+
// "2 to the 5th" programming competition @ engineering.cerner.com
4+
//
5+
// Read in the ASCII art file and simply print it to the console.
6+
// Note: This assumes you are executing "gcc art.c -o art && ./art"
7+
// in the current working directory.
8+
//
9+
// Reference: http://stackoverflow.com/questions/14062910/clearest-way-to-read-and-print-txt-file-lines-in-c
10+
//
11+
int main(int argc, char **argv)
12+
{
13+
FILE* filePtr;
14+
const char* fileName = "../art/alan.txt";
15+
if ((filePtr = fopen(fileName, "r")) != 0) {
16+
char* buffer = 0;
17+
size_t bufferLength = 0;
18+
while (getline(&buffer, &bufferLength, filePtr) != -1)
19+
fputs(buffer, stdout);
20+
21+
// Clean up
22+
fclose(filePtr);
23+
}
24+
return(0);
25+
}

ooc/art.ooc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import io/File
2+
3+
// "2 to the 5th" programming competition @ engineering.cerner.com
4+
//
5+
// Read in the ASCII art file and simply print it to the console.
6+
// Note: This assumes you are executing "rock art.ooc && ./art"
7+
// in the current working directory.
8+
println(File new("../art/alan.txt") read())

scala/Art.scala

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import scala.io.Source
2+
3+
// "2 to the 5th" programming competition @ engineering.cerner.com
4+
//
5+
// Read in the ASCII art file and simply print it to the console.
6+
// Note: This assumes you are executing "scalac Art.scala && scala Art"
7+
// in the current working directory.
8+
object Art extends App {
9+
for(line <- Source.fromFile("../art/alan.txt").getLines())
10+
println(line)
11+
}

0 commit comments

Comments
 (0)