My computer often gets CPU spikes, and I want to use C++ to find out what is causing the problem the close it. I have looked around a bit and seen that system() might be good for closing something but I'm not sure how to, + i need to find out how to get info about CPU usage.
Ever hear about the task manager? It tells you cpu usage and you can close programs. System is also kind of bad to use ( also only for windows but so is task manager also I suppose. ) If you really want to make a program to mimic the task manager someone else will have to help you out with that :p
There's also the Windows Performance Monitor MMC snap-in, if your talking about apps. Either launch it via the shell, or you can run it from a command console as perfmon.exe actually perfmon.msc (edit: more correct, for the modern version.)
The Performance Monitor snap-in (edit: to use its new name) is kind of a more souped up version of Task Manager which can save configurations, log output, etc.