if the virus suggestion doesn't fix anything, i had a similar problem but it wasn't virus related.
basically every time my computer was doing anything that took alot of processor power it would overheat and shut itself down (with no warning - just powered off) to prevent hardware damage... if this is the problem, you'll hear your computer fans working at full speed lol.
if you open up your computer tower, and look at the fan that keeps the heatsink cool... if its caked with dust, just buy some canned air dust cleaner stuff and give it a good cleaning.. it worked for me.
this is what you're looking for if this is the problem...

if it looks anything like this.. just dust it out with the canned air

i know its a shot in the dark... but its an easy fix and alot better than formatting a computer. you won't lose any data and it will take litteraly 5-10 minutes..