#include <iostream>
using namespace std;
int count;
int main( ) {
int somma = 0 ;
int numero_corrente, numero_precedente;
bool primo_input = true ;
std:: cout << "Inserisci numeri interi (si fermerà se inserisci due volte consecutive lo stesso numero):\n " ;
while ( true ) {
std:: cout << "Inserisci un numero: " ;
std:: cin >> numero_corrente;
somma + = numero_corrente;
if ( ! primo_input && numero_corrente == numero_precedente) {
std:: cout << "Hai inserito due volte consecutive lo stesso numero. Programma terminato.\n " ;
break ;
}
numero_precedente = numero_corrente;
primo_input = false ;
}
std:: cout << "La somma totale è: " << somma << std:: endl ;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgY291bnQ7CgppbnQgbWFpbigpIHsKCSBpbnQgc29tbWEgPSAwOwogICAgaW50IG51bWVyb19jb3JyZW50ZSwgbnVtZXJvX3ByZWNlZGVudGU7CiAgICBib29sIHByaW1vX2lucHV0ID0gdHJ1ZTsKCiAgICBzdGQ6OmNvdXQgPDwgIkluc2VyaXNjaSBudW1lcmkgaW50ZXJpIChzaSBmZXJtZXLDoCBzZSBpbnNlcmlzY2kgZHVlIHZvbHRlIGNvbnNlY3V0aXZlIGxvIHN0ZXNzbyBudW1lcm8pOlxuIjsKCiAgICB3aGlsZSAodHJ1ZSkgewogICAgICAgIHN0ZDo6Y291dCA8PCAiSW5zZXJpc2NpIHVuIG51bWVybzogIjsKICAgICAgICBzdGQ6OmNpbiA+PiBudW1lcm9fY29ycmVudGU7CgogICAgICAgIHNvbW1hICs9IG51bWVyb19jb3JyZW50ZTsKCiAgICAgICAgaWYgKCFwcmltb19pbnB1dCAmJiBudW1lcm9fY29ycmVudGUgPT0gbnVtZXJvX3ByZWNlZGVudGUpIHsKICAgICAgICAgICAgc3RkOjpjb3V0IDw8ICJIYWkgaW5zZXJpdG8gZHVlIHZvbHRlIGNvbnNlY3V0aXZlIGxvIHN0ZXNzbyBudW1lcm8uIFByb2dyYW1tYSB0ZXJtaW5hdG8uXG4iOwogICAgICAgICAgICBicmVhazsKICAgICAgICB9CgogICAgICAgIG51bWVyb19wcmVjZWRlbnRlID0gbnVtZXJvX2NvcnJlbnRlOwogICAgICAgIHByaW1vX2lucHV0ID0gZmFsc2U7CiAgICB9CgogICAgc3RkOjpjb3V0IDw8ICJMYSBzb21tYSB0b3RhbGUgw6g6ICIgPDwgc29tbWEgPDwgc3RkOjplbmRsOwoKCXJldHVybiAwOwp9