A virus is any computer program that can make copies of itself and spread from one computer to another without the help of a person.
Besides duplicating themselves, viruses are often programmed to carry out other actions.
These actions are called payloads and vary from annoying (for example, altering someone's homepage) to damaging (deleting system files).
Because viruses are computer programs, they can do anything a normal program can do, including deleting files and formatting hard drives.