#include <iostream>
#include <locale.h>
using namespace std;
int getnegativo(int a, int b);
int main() {
setlocale(LC_ALL, "portuguese");
int cont, cot = 0;
do {
cout << "digite um valor: ";
cin >> cont;
cot = getnegativo(cont, cot);
} while (cont != -1);
cout << "número de valores negativos digitados: " << cot;
cout << endl << endl;
return 0;
}
int getnegativo(int a, int b){
if (a < 0)
b++;
return b;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bG9jYWxlLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IGdldG5lZ2F0aXZvKGludCBhLCBpbnQgYik7CgppbnQgbWFpbigpIHsKICAgIHNldGxvY2FsZShMQ19BTEwsICJwb3J0dWd1ZXNlIik7CiAgICBpbnQgY29udCwgY290ID0gMDsKCiAgICBkbyB7CiAgICAgICAgY291dCA8PCAiZGlnaXRlIHVtIHZhbG9yOiAiOwogICAgICAgIGNpbiA+PiBjb250OwoKICAgICAgY290ID0gZ2V0bmVnYXRpdm8oY29udCwgY290KTsKCiAgICB9IHdoaWxlIChjb250ICE9IC0xKTsKCiAgICBjb3V0IDw8ICJuw7ptZXJvIGRlIHZhbG9yZXMgbmVnYXRpdm9zIGRpZ2l0YWRvczogIiA8PCBjb3Q7CgogICAgY291dCA8PCBlbmRsIDw8IGVuZGw7CiAgICByZXR1cm4gMDsKfQoKCmludCBnZXRuZWdhdGl2byhpbnQgYSwgaW50IGIpewogICAgaWYgKGEgPCAwKQogICAgICAgIGIrKzsKICAgIHJldHVybiBiOwp9