HW7
COP-3223H
Setup
On eustis, you can create, compile, and run a homework in your assignments repo:
Log in to eustis
ssh NID@eustis.eecs.ucf.edu
Create a directory for your homework programs (if not already created):
mkdir -p ~/cop3223spring26/assignments/hw/
Enter the homework directory:
cd ~/cop3223spring26/assignments/hw
For each homework problem, use emacs to create and type out the homework problem, e.g.,
hw7-1.c:emacs hw7-1.c
Compile and run the program to test it:
gcc -o hw7-1 hw7-1.c ./hw7-1
- Repeat from step 4 as needed to get the correct program execution
Questions
(
hw7-1.c) Hand-copy yourself without copy-and-paste the following program into a file on eustis and compile and run it.#include <stdio.h> int main(int argc, char **argv) { printf("%d\n", (22/7 + 355/113) / 2); }- (
hw7-2.c) Using only the C program template from class and without precomputing any intermediate values of the expression, write a program that computes \(10^2 - 7^2 - (10 - 7)(10 + 7) + 5\). There should be eight arithmetic operators in the expression (not counting parentheses). Create, cop
Submission
Submit the homework via git using whatever file names you used for the homework programs:
git add hw7-1.c git add hw7-2.c git commit hw7-1.c hw7-2.c git push
Self-check
Remove the previous self-check
If you have already run the self-check, you can remove it like this
rm -rf ~/tmp/assignments_selfcheck
Double-check the path carefully to avoid deleting the wrong directory.
Make a fresh clone of your project
git clone gitolite3@eustis3.eecs.ucf.edu:cop3223/$USER/assignments ~/tmp/assignments_selfcheck
You should see something like
Cloning into '/home/net/NID/tmp/assignments_selfcheck'... Welcome to eustis.eecs.ucf.edu. Please use your NID and NID password to log in. See http://t.cs.ucf.edu/help/eustis for additional instructions. remote: Enumerating objects: 16, done. remote: Counting objects: 100% (16/16), done. remote: Compressing objects: 100% (12/12), done. remote: Total 16 (delta 1), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (16/16), done. Resolving deltas: 100% (1/1), done.
If you see
fatal: destination path '/home/net/NID/tmp/assignments_selfcheck already exists and is not an empty directory.
Enter the fresh clone's hw directory
cd ~/tmp/assignments_selfcheck/hw
From here you can explore the repository to make sure that you have submitted the correct files for the given assignments. For instance, for this homework, make sure hw7-1.c and hw7-2.c are present and compile and run correctly.