Sup guys...I tried to make a little program my brother asked for to try and increase his odds of winning the lotto! lol...
anywho, It compiles and runs fine on my computer, but I tried it on two different computers running XP, and it doesnt work =(
Both computers I tried it on were XP, but come to think of it, one is an x64, and the other may be also...
anywho, here is the code:
#include "stdafx.h"
#include <fstream>
#include <iostream>
using namespace std;
struct PAIR
{
UINT num1, num2;
UINT lastdrawn;
};
int _tmain(int argc, _TCHAR* argv[])
{
UINT R[20];
UINT pair_matrix[71][71];
UINT day = 1;
PAIR pairs[4900];
ofstream fout;
ifstream fin;
cout << "Initializing.....";
memset(&pair_matrix[0], 0, 71*71*sizeof(UINT));
memset(&pairs, 0, 4900*sizeof(PAIR));
cout << "Done" << endl;
cout << "Opening results.txt.....";
fin.open("results.txt");
if(!fin.is_open())
{
cout << "Could not open results.txt. Exiting program..." << endl;
system("pause");
return 0;
}
cout << "Success" << endl;
cout << "Scanning numbers.....";
while (!fin.eof())
{
fin >> R[0];
if(R[0] == 0) continue;
fin >> R[1] >> R[2] >> R[3] >> R[4] >> R[5] >> R[6] >> R[7] >> R[8] >> R[9] >> R[10]
>> R[11] >> R[12] >> R[13] >> R[14] >> R[15] >> R[16] >> R[17] >> R[18] >> R[19];
for(int x = 0; x < 19; x++)
for(int y = x+1; y < 20; y++)
if(pair_matrix[R[x]][R[y]] == 0)
pair_matrix[R[x]][R[y]] = day;
day++;
}
cout << "Finished" << endl;
cout << "Building pair list.....";
fout.open("pairs.txt");
for(int x = 1; x <= 69; x++)
{
for(int y = x+1; y <= 70; y++)
{
for(int p = 0; p < 4900; p++)
{
if(pair_matrix[x][y] > pairs[p].lastdrawn)
{
for(int b = 4900-1; b > p; b--)
{
pairs[b] = pairs[b-1];
}
pairs[p].lastdrawn = pair_matrix[x][y];
pairs[p].num1 = x;
pairs[p].num2 = y;
break;
}
}
}
}
fout << " |last drawn| |pair|" << endl;
for(int p = 4899; p >= 0; p--)
{
if(pairs[p].num1 != 0)
{
fout << " " << pairs[p].lastdrawn << " (" << pairs[p].num1 << ", " << pairs[p].num2 << ")" << endl;
}
}
fout.close();
fin.close();
cout << "Finished." << endl << "Statistics were saved in pairs.txt" << endl;
system("pause");
return 1;
}
is there any reason that this shouldn't work on Windows XP? or could it be because of the x64 cpu? when I ran it on the other computer (when my roomie took a run to the corner store lol) it said something about bad configuration...
thanks for any help =)
btw: I am comiling and running it on Vista home basic.