Take a deep breath
You may have lost everything. So take that deep breath. We have all been there.
But maybe it is not lost.
Some guidelines:
First, always state what program you were using. If we know this, we might be able to help you.
Here is what Word 2003 says about recovering a file after a power outage:
To be able to recover the previous version of your document after a power failure or similar problem, you must have the Always create backup copy check box selected on the Save tab in the Options dialog box (Tools menu) before the problem occurs, and you must have saved the document more than once.
1. Click Open.
2. In the Files of type box, click All Files.
3. If you want to open a backup copy that was saved in a different folder, locate and open the folder.
4. Click the arrow next to Views, and then click Details.
In the Name column, the backup copy name appears as "Backup of document name"; in the Type column, the file type for the backup copy appears as "Microsoft Word Backup Document."
5. Locate and then double-click the backup copy to open it.
A word of advice. Go to Wal-Mart and buy a backup battery. No, this is not some huge, expensive, ugly device. It is about 10 inches long and 3 inches tall, and is completely enclosed in plastic. It has all sorts of plug-ins for various things. Basically all you do is plug it into your wall, and then you plug the computer into the backup. It lasts a long time (I don't know how long, exactly, but I have been using mine for about four years). I can't remember what the cost was, but I think it was something like $30. You don't need an expensive one that runs for a really long time. Just get one that will power the system for 20 minutes or whatever. When the power goes off, you don't have a thing to worry about. The battery will run your computer plenty long enough for you to save everything and turn the computer off. The battery will probably also be a surge protector (mine is).
I have had this happen many times, including within the last week.
Back to software ... If your writing program will let you do an autobackup every so many minutes, turn it on to back up the file every 5 minutes or whatever is right for you. I don't do this anymore, because I hit the SAVE icon every time I finish a couple of brilliant sentences.
Also, the backup battery has relieved me of having to worry about the power going out.
One further bit of advice. Get one of these plug-in thumb drives, which are really cheap now. Back up your important files before you turn off your computer (if not more often). Your computer will die one day, and while getting files from a dead computer is technically possible, it is not cheap or convenient. Avoid that problem.