I'm writing a program to create a 2D vector and randomly populate it with 1's and -1's. I'm attempting to use classes because I think later it will help a lot. Inside of main I have the user enter three variables two constants and the length of vector to be populated. Based on setting up flags in the program it seems like the "segmentation core dump" happens after I ask the user for the variable L in main.
Line 62 looks wrong. 1/2 is always 0 due to integer division. I think you want 2*(rand()%2) -1.
As for the crash, it's probably at line 29 but I'm not certain. Try running the code in a debugger to see where it crashes. Note that (1) the first time through the loop you're computing (-1)%length and (2) you have latttice[(i+1)%length][j] in the expression twice.