Before Submitting Any Program:
- Strive to finish at least one day in advance of the deadline. This will allow time for you to come for help when the inevitable issues occur.
- Always compile and execute one final time. Programs must compile to receive any credit.
- Ensure that your program executes correctly, producing correct output.
- Ensure that your program has plenty of comments, including a block comment at the top with name, date, and program purpose; block comments prior to each method, and inline comments. Insufficient comments will not earn full points.
- Ensure that you have consistent and proper indentation.
- Ensure that you have generous use of whitespace.
- Give the user meaningful usage/error messages.
For example,
"Incorrect number of files."
is not very helpful."Usage: ./problem1 [input text filename] [output text filename]"
is clear and helpful.
Follow specifications carefully and precisely. This will require you to read the assignment carefully.
When I mention example programs in the specifications, it is in your best interests to go investigate those programs, rather than just rely on something you might find on stackoverflow. For example, there is an approach I want you to use for reading from files, which will be available in a provided example program. Follow that as a guide.
Supplementary Readings/Tutorials/How-To's
- C++ Super-FAQ
- C++ Reference
- Coding Standards [pdf] (Dr. Kelly Shaw)
- Mac Unix Tutorial for Beginners
- GDB HowTo (Dr. Tia Newhall)
- Vim Quick Reference Card [pdf]
- Using SSH (machines available in S2020: mathcs{01-06}, turing2)
Online Books
-
(You may need to register here)
- C++ Primer Plus (Prata)
- A Tour of C++ (Stroustrup)
- The C++ Programming Language (Stroustrup, 4th ed.)
- Head First Object-Oriented Analysis & Design (McLaughlin et al.)
- Head First Design Patterns (Sierra et al.)
General Related Info
Secure-copy instructions:
Secure copy from Linux network to local machine:
Creating, extracting, and viewing tar files:
Like most unix commands, there are many flavors. I'll give you just one of each (though you are welcome to explore the man pages to learn and use more).
The flags here stand for the following: `c' means create a tar file, `v' means do it in verbose mode (list the files being added to the tar file), and `f' means write (or in other commands, possible read) the files to the specified tar file name.
If you have a project directory, perhaps called project1, and you wish to create a tar file that maintains the directory structure of your project, move to the parent directory of project1, and run the command
This will tar everything in the project 1 directory. Moreover, when you extract this tar file, it will create a directory called project1 which will be an exact copy of your project1 directory.
To extract the tar file foo.tar, run the command
The `x' flag here is short for ``extract''.
Finally, to view the contents of a tar file without extracting it, use the command
The `t' flag here means you want to examine the contents of the tar file.
Possible Remote-Linux Workflow:
- Mac: Install XCode + Command-Line Tools
- Windows: Install Linux Subsystem, Atom, g++
- UR's Virtual Private Network (VPN) and Duo software
- To display X11 windows from Linux on your local machine (may be slow):
- Mac: XQuartz
- Linux subsystem for Windows: (see instructions linked above...)
- To launch entire Linux-desktop window on your local machine (likely faster than above):
- open a terminal
- ssh to one of the mathcs or turing machines (see below)
- execute:
xwinrhel7.sh
- Secure-shell instructions:
- To ssh to one of the mathcs machines (01, 02, ..., 06):
ssh -Y ab2cd@mathcs03
- To ssh to one of the mathcs machines (01, 02, ..., 06):
- To ssh to turing2:
ssh -Y ab2cd@turing2
- (Either direction of scp below should be executed from your local machine, not while ssh'd into the Linux network)
- Secure copy from local machine to Linux network:
- one file:
scp myprog.cpp ab2cd@mathcs03:~/cmsc240/prog1/
- directory:
scp -r prog1/ ab2cd@mathcs03:~/cmsc240/
- one file:
scp ab2cd@mathcs03:~/cmsc240/prog1/myprog.cpp .
- directory:
scp -r ab2cd@mathcs03:~/cmsc240/prog1/ .
Like most unix commands, there are many flavors. I'll give you just one of each (though you are welcome to explore the man pages to learn and use more).
- To create a tar (short for ``tape archive'') file called foo.tar, and that contains the files file1.c and file2.c,
you should move to the directory that contains both files (I assume they are both in the same directory). Once in that directory,
you can create the tar file by running the command:
tar -cvf foo.tar file1.c file2.c
The flags here stand for the following: `c' means create a tar file, `v' means do it in verbose mode (list the files being added to the tar file), and `f' means write (or in other commands, possible read) the files to the specified tar file name.
If you have a project directory, perhaps called project1, and you wish to create a tar file that maintains the directory structure of your project, move to the parent directory of project1, and run the command
tar -cvf foo.tar project1/*
This will tar everything in the project 1 directory. Moreover, when you extract this tar file, it will create a directory called project1 which will be an exact copy of your project1 directory.
tar -xvf foo.tar
The `x' flag here is short for ``extract''.
tar -tvf foo.tar
The `t' flag here means you want to examine the contents of the tar file.
- Open one terminal, maintained on your local machine
- Open another terminal, and
ssh
into mathcs{01-06} or turing2 - Edit programs locally using Atom/Sublime/etc. on your machine
- For convenience, compile and test locally before pushing to remote machine
- From local terminal,
scp
your program(s) to mathcs{01-06} or turing2 - From remote-ssh terminal, compile and execute your programs remotely