possible for you to write a programme that gives your device more charge or charges it without any wires, just c++ code.
Programs are bound by the capabilities of the computers that execute them, and computers, being physical objects, are bound by the laws of physics.
how about a c++ that turns Lights off and on.
This can be done, if you connect your light switches to the computer. There are home automation kits you can buy online that do this. It's usually more of a hassle than it's worth. When are you ever going to need to change the state of your lighting when you're not around to press the switch?
wireless chargers do exist, at tiny ranges, see your electric toothbrush for an example. I think you can charge via induction at a few mm distance.
that could be done via c++ code, if you had the relevant hardware.
lightswitches also will need you to have some sort of hardware attached to your pc. You can't do movie star hacker crap like hack into your homes electrical system from your computer's power cord. It does not work like that.