Converting division expression in C ++ to C #

0

I have the following condition in C ++ and would like to move to C #. The problem I'm having is with the div function that displays the error:

  

The name 'div' does not exist in the current context

if (quant > 0)
{
    return  div(quant, 7).quot;
}
    
asked by anonymous 01.10.2014 / 18:37

1 answer

4

From what I understand, you want to split up and get only the quotient. If this is it, I see no reason to use the div function even in C ++. The same goes for C #. In fact, C # does not even have a similar function ready (the advantage of this function is to return both the quotient and the rest) so you have an error trying to use it.

So in C # you just need to do a simple split with the split operator . Your code would look like this:

if (quant > 0)
{
    return  quant / 7;
}
    
01.10.2014 / 19:01