std::string BigInteger::encodeDecimal(unsigned char* buffer, unsigned long bufferLength) { int indiceDeSeguridad = 2048; // Para no entrar en un bucle infonito. BigInteger hexserial(bufferLength); memcpy(hexserial.m_buffer, buffer,bufferLength); BigInteger base10(1); base10[0] = 0x0A; BigInteger cero(1); cero[0] = 0; char b[100]; std::string decimalStr = ""; while((!(hexserial == cero))&&(indiceDeSeguridad--)) { long resto = hexserial % base10; hexserial = hexserial / base10; ltoa(resto,b,10); decimalStr = std::string(b) + decimalStr; } return decimalStr; }
// --- void AticAtacTimeCounter::setSeconds (int nS) { int nM = (nS / 60); int nSS = (nS % 60); std::string cero (2, '0'); std::stringstream nMT; nMT << nM; std::string nMTs = nMT.str (); std::stringstream nST; nST << nSS; std::string nSTs = nST.str (); std::string tx = cero.substr (0, 2 - nMTs.length ()) + nMTs + ":" + cero.substr (0, 2 - nSTs.length ()) + nSTs; setText (tx); }
main() { int cole[L][Z],dos; cero(cole); printf("Carga de la tabla. Para finalizar, ingrese linea=0\n"); carga2(cole); printf("Cantidad de pasajeros linea 1: %d",) printf("Ingrese n° de linea para indicar cantidad de pasajeros encuestados\n"); scanf("%d",&dos); printf("Cantidad de pasajeros encuestados para la linea %d: %d \n",dos,cant_pas(cole,dos-1,0)); }