# Lotto program

• 06-23-2013
MrQ
Lotto program
Hello!
I have a little problem with a lotto program. I have the source code and when i put it in the compiler it gives me some errors. The program should do something like this: take the last draw of a 6 49 lottery, break all 6 numbers in all 15 pairs, and then search each pair in the past draws to see where has hit recently. It shows how many draws elapsed since last hit. The source code is like this:

Code:

```// Here i see the 1-15 pirs   int int0, int1, int2, int3, int4, int5, int6; int pair[15][3]; int foundul=0; for (int0=0; int0<15; int0++) { pair[int0][0]=0; pair[int0][1]=0; pair[int0][2]=0; }   // until here i make for each draw (ik) a new matrix, with zero all the values;     // starting from here i make the matrix of the pairs, according to history draws... this function executes each time ik changes, for every draw, //starting from ik+1 to the end... (in my case 912). Normaly this 912 must be a variable, or input from keyboard by user,   for (int3=(ik+1); int3<912; int3++)             for (int4=0; int4<6; int4++)               for (int5=0; int5<6; int5++)           if (int4!=int5)         {         for (int1=0; int1<6; int1++)                 for (int2=0; int2<6; int2++)               if ((tabel[ik][int1]==tabel[int3][int4])&&(tabel[ik][int2]==tabel[int3][int5])&&(int1!=int2))         {           int found=0;             for (int6=0; int6<15; int6++)                 {                 if ((tabel[int3][int4]==pair[int6][0])&&(tabel[int3][int5]==pair[int6][1])) found=found+1;                 if ((tabel[int3][int4]==pair[int6][1])&&(tabel[int3][int5]==pair[int6][0])) found=found+1;                 }             if (found==0) foundul=foundul+1;           if (found==0) pair[foundul-1][0]=tabel[ik][int1];           if (found==0) pair[foundul-1][1]=tabel[ik][int2];           if (found==0) pair[foundul-1][2]=(int3-ik);             }         }          // here i print the pairs    int int13;  for (int13=0; int13<15; int13++)  {     fprintf (fp, "\n%d %d  %d    pair no %d", pair[int13][0], pair[int13][1], pair[int13][2], int13);    }     // Here i finish the 1-15 pairs```
And the result should look like this:
pool no 1
12 44 2 pair no 0
30 44 12 pair no 1
30 49 24 pair no 2

................
12 44 is the pair
2 is the draws when last hit.

• 06-23-2013
rogster001
You are not making it any easier for yourself by naming your vars and loop comtrols as numbers, it is totally confusing, terrible naming convention, just use i,j,k for nested loops or call them something meaningful like int drawCount, int pairCount
• 06-23-2013
MrQ
I can't do it! All i have is errors like:

"Line 9 C:\Users\Admin\Desktop\Dev-Cpp 5.4.2 MinGW 4.7.2 Portable\loto.c [Error] expected identifier or '(' before 'for' "
Line 18 C:\Users\Admin\Desktop\Dev-Cpp 5.4.2 MinGW 4.7.2 Portable\loto.c [Error] expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
• 06-24-2013
iMalc
Oh, you're clearly one of those F (feeling) personality types. Just an observation. This will make it a lot more difficult to get help with your actual program. You may need to step outside your comfort zone by putting your feelings aside and just focusing on providing answers to any questions we have of you etc.
For example: is this your entire file? (Line 9 certainly has a 'for' on it). Program code must be contained within a function.
I would expect a main function for this code. Do you have a 'main' function for this?
How do you come to have so much code that will not compile? A general development process is to write only a couple of lines at a time, compile that, and repeat. If it does not compile then the bug is probably in the last few lines you added or changed.
When dealing with errors, always start from the first one it shows you. Fix that one and then hit compile again. Often times other errors will go away as they may have been aresult of the one you just fixed.

Don't despair, you'll get there, just keep at it.