Calculating how many times I need to send a string

0

I have a service that updates controller card status ..

Only it only returns me 22 records at a time. So I need to get the number of items I want to update and send the amount of messages needed to update them all.

Example: I have 5 boards. I only send one update request.          I have 23 plates. I have to send two requisitions (1 through 22, and the other only with 23)

Could anyone help me do this?

    
asked by anonymous 11.03.2015 / 14:14

1 answer

1

I do not know if I understood the question well, but maybe it's something like this:

int numPlacas = CountPlacas();
const int numMaxRegistrosPorMensagem = 22;

int numMensagensNecessarias = (int)numPlacas  / numMaxRegistrosPorMensagem;

if((numPlacas % numMaxRegistrosPorMensagem) > 0)
    numMensagensNecessarias++;
    
11.03.2015 / 14:22