if lottonums [col]!=
array [row][col]
break;
if col = 6 got match
brackets around these if conditions would be a good start, although if col = 6 got match
isn't even legal code. plus if you're testing against a number, use '==' and not '='.
#include <iostream>
#include <fstream>
#include <iomanip>
usingnamespace std;
int main ()
{
int row, col, array [10] [6], lottonums [6];
cout << "Here is the numbers you have purchased.\n" << endl;
ifstream infile;
infile.open ("Array Data.txt");
cout << setprecision(2) << fixed << right;
for(row = 0; row < 10; row++)
{
cout << "Group" << setw(3) << row+1;
for(col = 0; col < 6; col++ )
{
infile >> array [row][col];
cout << setw(8) << array [row][col] << " ";
}
cout << '\n';
}
system("PAUSE");
cout << "\nWhat Are Today's Winning Numbers?\n";
for (int i =0; i < 6; i++)
{
cout << "Enter Numbers One At A Time:";
cin >> lottonums [i];
}
for (row = 0; row > 10; row++ )
{
for (col = 0; col > 6; col++ )
{
if (lottonums [col] !=
array [row][col])
break;
if (col == 6)
cout << "You Have A Match!";
}
}
infile.close();
return 0;
}
This Is What Happens When I Run It, With A Number That Is In The File.
Here is the numbers you have purchased.
Group 1 8 15 28 29 48 59
Group 2 10 16 33 42 44 51
Group 3 5 7 8 14 21 29
Group 4 10 32 34 42 47 54
Group 5 11 21 27 28 37 38
Group 6 1 12 23 34 45 54
Group 7 7 11 22 33 44 50
Group 8 8 17 29 35 43 45
Group 9 1 3 5 7 9 11
Group 10 2 4 6 8 10 12
Press any key to continue . . .
What Are Today's Winning Numbers?
Enter Numbers One At A Time:2
Enter Numbers One At A Time:4
Enter Numbers One At A Time:6
Enter Numbers One At A Time:8
Enter Numbers One At A Time:10
Enter Numbers One At A Time:12
--------------------------------
Process exited with return value 0
Press any key to continue . . .