2015-03-01から1ヶ月間の記事一覧

Or.hdl

// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/01/Or.hdl /** * Or gate: * out = 1 if (a == 1 or b == 1) * 0 otherwise */ CHIP Or {…

Not.hdl

// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/01/Not.hdl /** * Not gate: * out = not in */ CHIP Not { IN in; OUT out; PARTS: Nand…

And.hdl

// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/01/And.hdl /** * And gate: * out = 1 if (a == 1 and b == 1) * 0 otherwise */ CHIP A…

c getopt

#include <stdio.h> #include <unistd.h> int main(int argc, char *argv[]) { char *delivery = ""; int thick = 0; int count = 0; char ch; while ((ch = getopt(argc, argv, "d:t")) != EOF) switch (ch) { case 'd': delivery = optarg; break; case 't': thick = 1; break</unistd.h></stdio.h>…