I have this problem i solved from a book. When i try to compile it using turbo C i get output #1 , while with MVC++ i get output #2. Obviously the first output has a problem. has turbo C has a long variable problem or did i just do something wrong here?

Output #1

(1) Total: 0

(2) Total: 0

(3) Total: 0

(4) Total: 0

(5) Total: 0

(6) Total: 0

(7) Total: 0

(8) Total: 0

(9) Total: 0

(10) Total: 0

(11) Total: 0

(12) Total: 0

Output #2

(1) Total: 0

(2) Total: 1051

(3) Total: 2024

(4) Total: 3027

(5) Total: 4018

(6) Total: 4869

(7) Total: 6018

(8) Total: 5007

(9) Total: 3968

(10) Total: 2979

(11) Total: 2012

(12) Total: 1027

PHP Code:

`#include<stdio.h>`

#include<time.h>

#include<stdlib.h>

#define TOTAL_ROLL 36000

int main()

{

long result[12] = { 0 };

long rollnum = 0, ipos;

int dice1, dice2, ires;

clrscr(); /* removed in mvc++ */

srand( time( 0 ) );

for( rollnum = 0; rollnum != TOTAL_ROLL; rollnum++ ){

dice1 = ( rand() % 6 ) + 1;

dice2 = ( rand() % 6 ) + 1;

ires = dice1 + dice2;

result[ires-1]++;

}

for( ipos = 0; ipos != 12; ipos++ ){

printf( "(%d) Total: %d\n", ipos+1, result[ipos] );

}

getch(); /* removed in mvc++ */

return 0;

}