New to C++.. need a little help

Hi there, I'm somewhat new to C++ and need a little help finishing this program..
So what it basically does is generate all possible combinations in a lottery system, which draws 15 numbers out of a 25 numbers range.
I think the way it is, it is only drawing one combination..
I also applied a few filters, but can't tell if they're right or not (such as verifying how many odds and even numbers, and checking them against past results that can be inserted by the user).
I don't know what i'm doing wrong.. can anyone help me?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <fstream>
#include <cstdio>

using namespace std;

void input();
void quit();
void displayall();
void search();
void editFile();
void GetNumbers();
  
const int ARRAY_SIZE = 15;           // SIZE of an array.
const int MAX_RANGE = 25;            // The max range between 1 to 25.
  
// Function prototype
void generateNumbers(int[], int);
int findMatches(int[], int[], int);
void displayValues(int[], int[], int);
  
int main()
{
       int lottery[ARRAY_SIZE];            // To hold the lottery's number in randomly. 
       int numMatches;                     // To holf the matching number.
	   int user[ARRAY_SIZE];               // To hold the user's number.

       system ("title Prototype");
       
       int choice;
       cout << "(1)Input last results" << endl;
       cout << "(2)Search database for last results" << endl;
       cout << "(3)Find possible combinations" << endl;
       cout << "(4)Exit Program" << endl;
       cin >> choice;
       
       switch (choice){
       case 1:
            input();
            break;
       case 2:
            search();
            break;
       case 3:
            GetNumbers();
            break;
       case 4:
            quit();
            break;
            
       cin.get();
            

       }
  }
       
void input(int user[], int ARRAY_SIZE)
{
 string array;
 ofstream pastresults("pastresults.txt", ios::app);
 system("cls");
 
       for(int index = 0; index < ARRAY_SIZE; index++)
       {
              cout << "Enter a number " << (index + 1) << ": "; 
              cin >> user[index];
       }
       pastresults << user << endl;     
 pastresults.close(); 
 main();
     }

void displayall()
{
	 int user;
     ifstream pastresults("pastresults.txt");
     string name;
     system ("CLS");
     cout << "Entire database"<< endl;
     cout << user << endl ;
     system ("pause");
     cin.get();
     main();
     
     }
  
     
void generateNumbers(int lottery[], int ARRAY_SIZE)
{
       srand((unsigned int)time(NULL));
	   int conditions; 
	   int a, sum, even, b, odd = 0 ;
       cout << "Possible numbers "
               << "in the range of 1 to 25." << endl;
       for (int index = 1; index < ARRAY_SIZE; index++)
       {
              lottery[index] = 0 + rand() % MAX_RANGE;
              for (a=1; a<=ARRAY_SIZE; a++){
              
	
				
	
								sum+=lottery[a];
								}
								for (b=1; b<=ARRAY_SIZE; b++){
									if ((lottery[b]) % 2== 0){
										even = 0 + 1;
									}
										else {
											odd = 0 + 1;
										}
									
								}
									
    	          
    	         
        }     
       cout << sum << endl;      
       
            
       
	   //Verifying if the average number is between 13 and 14
	   bool num = true;
	   
	   if (((sum/15) >= 13); ((sum/15) <=14)); {
	   	                      num = true;
	   	                      
	   	                      //Odds and even Numbers
	   	                      bool NumEvens = true;
	   	                      bool NumOdds = true;
	   	                      if (even <= 6; even >=9)
								{
									NumEvens = true;
								}
								if (odd <= 6; odd >=9)
								{
									NumOdds = true;
								}	   	                      
	   	                      //Verify if combination match past results
	   	                      
	   	                      bool arraysEqual = false;     // Flag variable.
       						  int count = 0;               // Loop counter.
                              int numMatches = 0;
                              ifstream pastresults("pastresults.txt");
                              string name;
                              system ("CLS");
  
    
							  // Determine whether the elements contain the same data.
       						  while (arraysEqual && count < ARRAY_SIZE)
       						  {
                              if (lottery[count] = user[count])
                              arraysEqual = false;
                              count++;
                              }
                              return numMatches;
                              
                              

       	   	                      
	   	                      // Display numbers that meet criteria
	   	                      if (num) && (arraysEqual) && (NumEvens) && (NumOdds){
	   	                      	cout << lottery;
	   	                      }
              
	      		   	
	   }       
}
Show your GetNumbers() function

EDIT: line 128: syntax error. This code should not compile at all. Show real code where you have problems.
Last edited on
Topic archived. No new replies allowed.