Basic C++ tutorial:

Go to:

Basic C++

Want more specific?

if statements

while statements

Solar Battery charger

big thanks to Canabots for SoR. you can find this diagram on his web site to.
(click Pic)
also you may want to add a diode right before the - terminal to prevent discharging