gcc compiler.
Program ~walker/211/labs/prog1.c includes code to print part
of a truth table.
gcc -o prog1 prog1.c
Then run the program by typing prog1 . Note: The compiling and running steps may combined with the command:
gcc -o prog1 prog1.c && prog1
void nor (int a, int b, int * res)
void and (int a, int b, int * res)
int or (int a, int b)
In each case, the function should perform the designated Boolean operation.
Specifically, define nor directly with C operations. Then
write and and or by calling any or all of
not, nand, and nor.
not, nor, nand, and and
or as defined in the previous program. That is, follow the logic
for a gate-level adder to perform the addition. To further simulate gate-level circuitry, consider each variable as the name of a separate wire in a circuit diagram. That is, follow these rules in writing your program:
proc (a, b, &result)orresult = f(a, b)
scanf ("%d %d", &x1, &x0);
Work to be turned in:
Form for listing, compiling, and running programs:
submit command to record the activity in a
terminal window.
cat filename to display the program in the terminal
window.
gcc command.
This document is available on the World Wide Web as
http://www.cs.grinnell.edu/~walker/courses/211.fa01/labs/lab.c-programming.html
|
created September 26, 1997 last revised October 30, 2001 |
|
| For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |