Board index » cppbuilder » It's a Begginer's Problem, plz help

It's a Begginer's Problem, plz help

It's a Begginer's Problem, plz help
I have got C++builder last week.
and my homework is write a prime number problem

BUT, a function "MOD"  CAN'T not be used....
I check help but helpfile don't mention which .h file needed.

So my question is : How could I use the "MOD" function in C++Builder??
Thanks a lot.

 

Re:It's a Begginer's Problem, plz help


Use the modulas operator: %
Quote
Stryker wrote:

> It's a Begginer's Problem, plz help
> I have got C++builder last week.
> and my homework is write a prime number problem

> BUT, a function "MOD"  CAN'T not be used....
> I check help but helpfile don't mention which .h file needed.

> So my question is : How could I use the "MOD" function in C++Builder??
> Thanks a lot.

Re:It's a Begginer's Problem, plz help


"MOD" is not a general function, the help does not mention this message, it
can not be used directly, only used in ActiveX. Instead, you can use "fmod"
function.

--
Guohua Zhao
zh...@omrf.ouhsc.edu

Stryker <b4209...@ms.cc.ntu.edu.tw> wrote in article
<368794AF.31289...@ms.cc.ntu.edu.tw>...

Quote
> It's a Begginer's Problem, plz help
> I have got C++builder last week.
> and my homework is write a prime number problem

> BUT, a function "MOD"  CAN'T not be used....
> I check help but helpfile don't mention which .h file needed.

> So my question is : How could I use the "MOD" function in C++Builder??
> Thanks a lot.

Re:It's a Begginer's Problem, plz help


Quote
Stryker wrote:

> It's a Begginer's Problem, plz help
> I have got C++builder last week.
> and my homework is write a prime number problem

> BUT, a function "MOD"  CAN'T not be used....
> I check help but helpfile don't mention which .h file needed.

> So my question is : How could I use the "MOD" function in C++Builder??
> Thanks a lot.

The operator % does the same as MOD in Delphi.

So: 8 % 3 == 2, because (as you already know) the remainder of the
division of 8 by 3 is 2.

Good luck.

Hans Kamp.

Other Threads