CSCI 103 Fall 2017: Introduction to Programming
Programming Assignment Warnings
This page tries to explain warnings and errors that you can get when uploading your code and checking it.
One reason these are important is that we print out your code for grading. If you fail to adhere to these rules, it won't print out the way you intended, and it can be hard to read or test your code.
file is indented with a mix of tabs and spaces
This means that your code might print with indentation other than what you intended.
Normally you shouldn't be getting this message unless you are not using the course VM or changed gedit's settings. Feel free to ask for help from the instructor figuring this out.
To fix the problem for a single file:
- Open gedit on the file causing the warning
- Press ctrl-H to open the Replace tool
- In "Search for:" type \t
- In "Replace with:" type 3 spaces
- Press Replace All and Close
- Save the file
Also you can change your editor to help solve this in the future, even having it insert spaces rather than actual tab characters even when you press the TAB key:
gsettings set org.gnome.gedit.preferences.editor auto-indent true gsettings set org.gnome.gedit.preferences.editor auto-save true gsettings set org.gnome.gedit.preferences.editor bracket-matching true gsettings set org.gnome.gedit.preferences.editor display-line-numbers true gsettings set org.gnome.gedit.preferences.editor display-right-margin true gsettings set org.gnome.gedit.preferences.editor insert-spaces true gsettings set org.gnome.gedit.preferences.editor auto-save-interval 10 gsettings set org.gnome.gedit.preferences.editor right-margin-position 75 gsettings set org.gnome.gedit.preferences.editor tabs-size 3
- Sublime Settings
found a line longer than 80 characters
If your lines are more than 80 characters long, they'll "wrap around" when we print them and be hard to read. You should fix this, even if it's just comments.
Note that C++ ignores whitespace, and a "new line" is just whitespace. So you can change
int x = some + incredibly * long - line (with, many, things[on][it]); // long!
// we'll break the line in two int x = some + incredibly * long - line (with, many, things[on][it]);
Moving comments above text instead of beside text can also help.
found non-ASCII characters
The most common non-ASCII characters are "smart quotes" or "smart hyphens" entered into your code by copying-and-pasting. You should delete these because we'll see garbage instead when your code is printed. And if they're in your code, it might not compile or run.
appears to be a 'rich text file' not a 'plain text file'
You might have edited this file with TextEdit on a Mac or WordPad on a PC. You can use the same program to open it and save it again in a plain text format.