The basic problem you're facing is: how do you actually suspend or wake the computer? Suspending is usually done by issuing a command, which is in and itself an executable (for example
apm(8) or
zzz(8). How do you intend to do this from your own C/C++ code? You could find the source code for these commands, and copy it into your program. From a software engineering perspective, that's an awful idea, it's duplication of effort. You could find a library that has this functionality (good luck!). Or you could invoke that other program from your C/C++ program (using
system(3) or fork/exec), but at that point your program has de-facto become a script that runs other programs.
1. The time to suspend or wakeup may be dynamic. For example, if the web crawler founds a web site is busy, it'll suspend the computer and try later.
You can do dynamic stuff in many languages. In C and C++, in assembly, in Python or Perl, and in shell scripts. For shell scripts, you often do that by using canned executables that are de-facto part of the shell environment, like sed, expr, sort, uniq, join and awk.
You need to get away from the wrong impression that programming happens in C/C++, and that programming is better than scripting. There are zillions of programming languages, and some are better suited to some problems, while others are better suited to other problems. For this problem, C/C++ seems needlessly complex.
2. The result of depending on libs is better than depending executables any way. For example, more controllable, more effective.
Libs are not standardized, are not portable, and can change with version upgrades. If you want "controllable", you should go to a standards-controlled way. For example, look at the POSIX documents, and use only POSIX standard interfaces. Now that could mean using a POSIX-standard shell to write a shell script, which at the end invokes
apm(8).