Unknown syntax error in one dimensional array loop

Hello beautiful people! I hope you are all having a great day/night. I am taking a C++ class and I am stuck. It is a simple program that asks you to input a 4 digit code as your password. If the code is found within a .txt document containing 300 four digit passwords then we get a "Welcome" message and the program closes. If the password is not found then we get 2 more chances to get it right (3 attempts overall). I tested the password search function and it works great. I was almost done but then the problem occurs when I try to integrate the loop system for the 3 wrong attempt. I get a build error and I have no idea what it is. I've been scratching my head for hours.

Please any help would be very much appreciate it. Thank you so much in advanced.

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
  #include "stdafx.h"
using namespace std;
#include <iostream>
#include <string>
#include <fstream>

void mySequentialSearch();
int i = 0, ii = 0;
int flag = 0;
string key;
int passAttempt = 3;
int main()
{
	while (passAttempt > 0)
	{
		bool x;
		do
		{
			cout << "===================Enter your code to access into the system====================" << endl;
			cout << "Enter 4 digit code" << endl;
			cin >> key;

			mySequentialSearch();

			if (flag == 1)
			{
				cout << "==================================================" << endl;
				cout << "ACCESS GRANTED \n WELCOME" << endl;
				cout << "==================================================" << endl;
				x = true;
			}

			else
			{
				cout << "NOT MATCHING! TRY AGAIN" << endl << endl;
				passAttempt--;
				cout << "You have " << passAttempt << "attempts remaining";
				cin >> key;
				x = false;
			}
			if (passAttempt == 0)
			{
				cout << "You have exceeded you attempts. Goodbye" << endl;
				return 0;
			}




		} while (x != true);
	


	system("pause");
    return 0;

}



void mySequentialSearch()

	{

		ifstream file("SystemAccessCodes.txt");
		if (file.is_open()) {
			string Password[300];

			for (int i = 0; i < 300; ++i)
			{
				file >> Password[i];

				if (Password[i] == key)
				{

					flag = 1;
					ii = i;
					break;
				}
			}
		}


	}

In other words, there are multiple keys to unlock the Welcome screen?
Yes, that's right. 300 different keys to unlock the welcome screen in this case.
Can you show me the contents of your password file?
Sure! It's just 300 random combination of 4 numbers, without any real meaning. It's called SystemAccessCodes.txt - Here it goes:
1450
1452
1454
1456
1458
1460
1462
1464
1466
1453
1463
1468
1470
1472
1474
1476
1478
1480
1482
1484
1486
1488
1490
1492
1494
1496
1498
1500
1502
1504
1506
1508
1510
1512
1514
1516
1518
1520
1522
1524
1526
1528
1530
1532
1534
1536
1538
1540
1542
1544
1546
1548
1550
1552
1554
1556
1558
1560
1562
1564
1566
1568
1570
1572
1574
1576
1578
1580
1582
1584
1586
1588
1590
1592
1594
1596
1598
1600
1602
1604
1606
1608
1610
1612
1614
1616
1618
1620
1622
1624
1626
1628
1630
1632
1634
1636
1638
1640
1642
1644
1646
1648
1650
1652
1654
1656
1658
1660
1662
1664
1666
1668
1670
1672
1674
1676
1678
1680
1682
1684
1686
1688
1690
1692
1694
1696
1698
1700
1702
1704
1706
1708
1710
1712
1714
1716
1718
1720
1722
1724
1726
1728
1730
1732
1734
1736
1738
1740
1742
1744
1746
1748
1750
1752
1754
1756
1758
1760
1762
1764
1766
1768
1770
1772
1774
1776
1778
1780
1782
1784
1786
1788
1790
1792
1794
1796
1798
1800
1802
1804
1806
1808
1810
1812
1814
1816
1818
1820
1822
1824
1826
1828
1830
1832
1834
1836
1838
1840
1842
1844
1846
1848
1850
1852
1854
1856
1858
1860
1862
1864
1866
1868
1870
1872
1874
1876
1878
1880
1882
1884
1886
1888
1890
1892
1894
1896
1898
1900
1902
1904
1906
1908
1910
1912
1914
1916
1918
1920
1922
1924
1926
1928
1930
1932
1934
1936
1938
1940
1942
1944
1946
1948
1950
1952
1954
1956
1958
1960
1962
1964
1966
1968
1970
1972
1974
1976
1978
1980
1982
1984
1986
1988
1990
1992
1994
1996
1998
2000
2002
2004
2006
2008
2010
2012
2014
2016
2018
2020
2022
2024
2026
2028
2030
2032
2034
2036
2038
2040
2042
2044

I get a build error and I have no idea what it is. I've been scratching my head for hours.

Can you show us your compiler error logs?
Error (active) expected a ';'

It says that for the curly bracket on line 63
OMG I think I was just missing a bracket. I swear that was the first thing I tried, I'm so sorry. Thank you so much for helping me though, I really appreciate it.
Take care!
Topic archived. No new replies allowed.