Re: Why does not my program is not running?

2015-08-21 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Thursday, 20 August 2015 at 21:15:36 UTC, anonymous2 wrote: On Thursday, 20 August 2015 at 21:11:07 UTC, anonymous wrote: I severely limited the range of integer. I don't know off the top of my head how large you can make it without hitting overflow. I removed the file writing, because I'm

Re: Why does not my program is not running?

2015-08-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/20/15 5:15 PM, anonymous2 wrote: On Thursday, 20 August 2015 at 21:11:07 UTC, anonymous wrote: I severely limited the range of integer. I don't know off the top of my head how large you can make it without hitting overflow. with integer == 66 the factorial overflows and becomes 0 (on my m

Re: Why does not my program is not running?

2015-08-20 Thread Unknow via Digitalmars-d-learn
On Thursday, 20 August 2015 at 21:10:27 UTC, Steven Schveighoffer wrote: On 8/20/15 4:31 PM, Unknow wrote: module main; import std.file; import std.conv; long factorial(long i){ if (i == 0){ return 1; }else{ return(i * factorial(i-1)); } } Note, this is not g

Re: Why does not my program is not running?

2015-08-20 Thread anonymous via Digitalmars-d-learn
On Thursday 20 August 2015 23:11, anonymous wrote: > 2) *integer++ doesn't do what you think it does. The increment is done > before the dereference. You could fix this, but: I got that one wrong. Steven Schveighoffer has it right. The pointer is incremented after the currently pointed-to value

Re: Why does not my program is not running?

2015-08-20 Thread anonymous2 via Digitalmars-d-learn
On Thursday, 20 August 2015 at 21:11:07 UTC, anonymous wrote: I severely limited the range of integer. I don't know off the top of my head how large you can make it without hitting overflow. I removed the file writing, because I'm not sure if you want to write it only when it doesn't exist, o

Re: Why does not my program is not running?

2015-08-20 Thread anonymous via Digitalmars-d-learn
On Thursday 20 August 2015 22:31, Unknow wrote: > I'm writed a program for calculating the e number. I can compile > the source code but when i try run the program, system gives > 'program stopped working' error. > > Source code; > """ > // main.d > > module main; > > import std.file; > import

Re: Why does not my program is not running?

2015-08-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/20/15 4:31 PM, Unknow wrote: module main; import std.file; import std.conv; long factorial(long i){ if (i == 0){ return 1; }else{ return(i * factorial(i-1)); } } Note, this is not going to work. At 21!, long will run out of bits. From https://en.wikipedi

Why does not my program is not running?

2015-08-20 Thread Unknow via Digitalmars-d-learn
I'm writed a program for calculating the e number. I can compile the source code but when i try run the program, system gives 'program stopped working' error. Source code; """ // main.d module main; import std.file; import std.conv; long factorial(long i){ if (i == 0){