This page contains guidelines for students in my courses regarding UNLV
Computer Science student accounts, compilation standards, coding standards,
submitting assignments, due dates, printing, attending class, and contacting me.
Please also see the tips page.
UNLV CS Accounts
- All students in my courses are required to have UNLV Computer Science student accounts.
- This account gives you access to the lab machines
in TBE B-346, TBE B-361, as well as
bobby.cs.unlv.edu, and two other CS servers:
- Students are required to submit their code on
bobby and also have access to all the necessary editors/compilers there as well.
- If you do not have an account (or have forgotten your password)
you can obtain one by visiting this page:
- Note that when using
gcc/g++ to compile C or C++ code,
will pick a default standard and then try to compile if possible.
- As of August 2017, bobby.cs.unlv.edu uses gcc 4.8.5 and, if not
g++ compiles with the C++98 standard and
gcc compiles with the gnu90 standard.
- You can read GCC documentation here: https://gcc.gnu.org/onlinedocs/.
- Some features found in later standards (e.g. range-based
in C++ or
for loop variable declarations in C)
are present in the texts or are commonly used now but will not work
without specifying a later standard than the default.
- It is good programming practice to specify a standard, as
standard-compliant code will compile on any compiler on any system that
implements that standard.
- Beyond specifying a standard,
gcc/g++ will also try to
compile your code and generally ignore minor issues that are questionable with
respect to the tandard. Warnings may be issued or they may be ignored.
- There are many
gcc/g++ flag options, but I require
students to compile with the following options:
-Werror - all warnings become errors.
-Wpedantic - issue more warnings about non-compliant
-Wall - issue "all" warnings.
-Wextra - issue extra warnings that aren't issued by
-std=c++11 - use the C++11 standard (use with
compiling C++ programs).
-std=c11 - use the C11 standard (use with
- More details about warning flags can be found at https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html.
- If you intend on using
gdb for debugging, you will also want to include the
-g option when compiling.
- The important coding standards we will adhere to are to use proper
comments, variable choices, variable declaration, variable identifiers, indenting, and spacing.
- For commenting, every source code file (.h or .cpp) must contain a comment at the top
containing your name, the course, the section, the assignment, and a
description of the file. For example:
/* John Smith - CS 202 - Section 1001 - Assignment 3
This program implements a fibonacci number
generator using a recursive function */
- Other comments should appear throughout the code, for example before
each function and function prototype describing what the function does, or around more
complex pieces of code (e.g. complicated loops or mathmeatical
expressions) to explain the logic.
- Unnecessary variables should not be declared. For example,
do not declare variables you are not going to use. Do not use
double when an
int will suffice. In general,
use as few variables as possible.
- Global variables, those declared outside the main body or functions, are
not allowed. In general they are bad style.
- In C++ and in recent C-standard code, variables should typically be
declared as locally as possible. Some programming languages, including
earlier C standards, required variables to be declared at the beginning of
a function (including main) and no other place. Unless required to do so,
variables should be declared as late as possible within the scope they are
- For variable identifiers, be sure to name variables appropriately
according to what the variables are used for. It is acceptable to use
standard variable names like
j to refer
to loop counters. For a variable that will be used to hold the sum of
inputs from a user that represent student grades, an appropriate name is
- We shall use the Allman
style. That is to say all open and close braces should match,
should appear in line with the function name or flow control command,
and code within blocks should be indented with a tab. All code that I
bobby and, I believe, in the Malik textbook, is
written using Allman style.
Here is some example code illustrating the style:
/* John Smith - CS 172 - Section 1002 - Assignment 8
This program does blah blah blah... */
/* This function is used to blah blah blah */
int function(int x)
int y = 40;
for (int i = 0; i < 100; i++)
y += x;
printf("y = %d\n",
for (int i = 0; i < 100; i++)
if (i %
if (i == 50)
printf("i is 50!\n");
is not 50, it is %d\n", i);
printf("Continuing doing some weird thing...\n");
- Note that braces are always on a line by themselves, and code inside the
braces is always indented.
- Use proper spacing between lines and functions. Sequences of
statements that are generally logically connected should be separated
from other logically connected statements with a blank line.
- Proper spacing also include not having single lines very long.
For example, if a
cout statement prints out 20 different
variables, you should put linebreaks in your code and make sure the lines
still line up. For example:
cout << "Hey here are some variables: " << variable1 << variable2 << variable3 << variable4 << variable5;
May appear better as:
cout << "Hey here are some variables: " << variable1 << variable2
<< variable3 << variable4 << variable5;
- Try to restrict lines to the standard 80-character width. This will generally look neater and, if printing out code, will cause fewer issues with printouts
Submitting Assignments Electronically
- For CS 135, students must turn their assignments in using
submit script on
bobby. For example, type
submit file.cpp 01 williams to turn in
file.cpp for assignment 1.
Change the filename and number (number should always be 01, 02, ...) as
- If you are confused on how to use
submit just type
bobby for usage instructions.
- For CS 202:
- Use the same instructions as 135 above, however offset
the assignment number by 10. For example, assignment 1 will have
assignment code 11, not 01.
- If the assignment consists of only a single .cpp file,
submit only that according to the CS 135 instructions above.
If the assignment requires multiple files,
please create a tarball and
submit it and not each file
- Make sure all your files are named
according to what the assignment dictates. In general I will require that
your files contain your
bobby login name.
- You must include a
makefile. An example would be:
g++ -Werror -Wall -Wextra -Wpedantic -c login.class_implementation.cpp
g++ -Werror -Wall -Wextra -Wpedantic -o login.out login.main.cpp login.class_implementation.o
- To create a tarball, use
tar -cvf myfiles.tar login.main.cpp login.class_implementation.cpp makefile
- Adjust the filenames above as appropriate.
- The name of the .tar file does not matter, as the
submit script renames it.
- The tarball should not contain any
directories in it. That is to say, when you type
tar -tf myfiles.tar,
only files should show up -- no directories!
submit the tarball on
bobby. It is normal to get an error about
binary files from
dos2unix, but do not worry about it. If it says the submission was
successful then it was.
- Assignments may receive a grade of 0 if they do not compile and/or adhere to the naming/submission guidelines above.
- You may submit your assignment as many times as you like, however only the last one before the submission deadline is graded.
- You are responsible for making sure that you have submitted your assignment by the deadline. Submissions even 1 minute late will not be accepted.
Make necessary arrangements to turn in the assignment on time.
- Not being able to connect to
bobby for any reason other than the server is down
(which I can check with the system administrators) is not an excuse.
- Do not ask me if have I received your submission. If the submission was successful the script will report "Successfully Submitted!"
- Do not forget that a hard copy of your program must also be submitted in class as well!
Submitting Assignments in Class
- A hard copy (printout of all source files) for all programs must be turned in at the beginning of
- For CS 202 only: You must also print out your makefile.
- Failure to turn in the electronic or paper copy of the program
by the designated due date & time will result in a grade of 0.
- The hard copy must be exactly the same as the electronic submission.
- Printouts should be single-sided, with one staple, and no paperclips.
- The order of the pages should be makefile first, class header, class implementation, class
header, class implementation, ..., main program.
- Source code must be printed out in a fixed-width font and it should look good (e.g. no sloppy line breaks,
font not too large or too small). In short, the hard copy should be visually appealing.
- Do not use something like Microsoft Word, Notepad, or Wordpad which will
generally mess with line breaks/word wrap stuff, have bad fonts, etc. I highly recommend
using Notepad++ for
- Do not forget than an electronic copy of your program is also due!
- Extensions on assignments are only given in rare circumstances, typically a documented medical excuse,
documented family emergency/death, documented religious holiday (per UNLV guidelines I must be notified within the first 1-2 weeks for this to be valid),
or documented UNLV extracurricular activity (e.g. part of a sports team).
- Even in the above cases, the documentation must be received in a timely manner or it may not be accepted.
- Students are responsible for attending class and doing so on time.
- If class is missed for any reason, it is the students responsibility
to ask another student for details about what they may have missed (e.g.
do not ask me what you missed).
- Adding the course late is not an excuse for missed lectures or assignments.
- Office hours are not intended to be used for the purpose of "catching up" on missed lectures.
- You can typically contact me via email for pretty much anything. I usually respond relateively
- You can always come by office hours for assistance if needed. I am more than willing to
talk about assignments, indivdiual course topics, or totally random topics.
- You can request a meeting outside of scheduled office hours, however I often plan my schedule out 2-3 days
in advance, so asking on Monday for a meeting on Tuesday will usually not work for me. The further out
you request a meeting, the more likely it is that I will be able to meet with you.
- You are welcome to talk to me before/after class, though I may have other commitments and may not be able to talk for long.
- Unless explicity told to, do not email me code:
- You do not submit your assignments by emailing them to me.
- If you have a question about code, please
come to my office hours. Dissecting code is usually a back-and-forth sort of process and can
- For the above reason you should also not show me code before/after class.
- I will not respond to any email containing your assignment whether it is to ask a question or to submit it!
- It is always fine to ask me via email about code examples posted on
bobby that I've
reviewed in class.
- It is always fine to ask me via email about general code questions (e.g. "Can you explain what
is the difference between
static_cast and C-style casting?").
- When coming to my office to ask for assistance with your code you can bring a laptop or we can
use one of my computers, but the code must be viewed/edited on
bobby. No IDEs (e.g. Code::Blocks) or fancy
editors (e.g. Sublime, Notepad++).