you can certainly password-protect files -- and even entire directories.... the easiest way is called "setting permissions" on *nix and windows has an equivalent, and the password protection is your account login. of course if you share an account the issue is moot. you also have no protection against the superuser or root (windows admin).
a more thorough but expensive solution (in time and money) is to get 3rd party encryption software to password-protect entire files and directories. This will stop everyone, up to and including industrial or government forensics agencies if you really want to pay for it.
but here's another, far more likely, possibility: nobody gives a flip about your C-programming homework. so forget about it.
By password protect I was assuming he meant that when you click on a file a window would popup and ask for a password, something similar to password-protected zip files. So that you could have different passwords for different files.