Tuesday, July 28, 2009

In c++, How do I write it so that the output of a function can only be greater than or equal to zero?

I'm writing a program for my c++ class with multiple functions, but the output of some of the functions are supposed to only have numbers greater than or equal to zero. I'm not sure how to only output certain numbers. Thanks!

In c++, How do I write it so that the output of a function can only be greater than or equal to zero?
Hi,





you can use the following lline of code:


return 0;


or


return i;


where i is an integer


with the functions which you want to output an integer.


Hope this will help you


Regds


Sunil
Reply:UINT function(...)


It will return always an unsigned int (which is %26gt;= 0).


No comments:

Post a Comment