#include <iostream>
int main()
{
std::cout << "please enter numbers to add seperated by a '+'\n"
"and end with a zero. for example: 12.6 + 5.4 + 9.2 + 0\n? " ;
float sum = 0.0 ;
float number ;
char c ;
while( std::cin >> number && number != 0 && std::cin >> c && c == '+' )
sum += number ;
std::cout << "sum is: " << sum << '\n' ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKQp7CiAgICBzdGQ6OmNvdXQgPDwgInBsZWFzZSBlbnRlciBudW1iZXJzIHRvIGFkZCBzZXBlcmF0ZWQgYnkgYSAnKydcbiIKICAgICAgICAgICAgICAgICAgImFuZCBlbmQgd2l0aCBhIHplcm8uIGZvciBleGFtcGxlOiAxMi42ICsgNS40ICsgOS4yICsgMFxuPyAiICA7CgogICAgZmxvYXQgc3VtID0gMC4wIDsKICAgIGZsb2F0IG51bWJlciA7CiAgICBjaGFyIGMgOwoKICAgIHdoaWxlKCBzdGQ6OmNpbiA+PiBudW1iZXIgJiYgbnVtYmVyICE9IDAgICYmIHN0ZDo6Y2luID4+IGMgJiYgYyA9PSAnKycgKQogICAgICAgIHN1bSArPSBudW1iZXIgOwoKICAgIHN0ZDo6Y291dCA8PCAic3VtIGlzOiAiIDw8IHN1bSA8PCAnXG4nIDsKfQo=