Xcode problems?

for some reason when i run this in xcode it wont run but works fine in visual studio i'm not sure what the problem is i think it may not be able to find the input file any help appreciated.

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

#include <iostream>
#include <string>
#include <fstream>

using namespace std;

//****************************************************************************************************

struct President  {
    string firstName;
    string lastName;
    int beginYear;
    int endYear;
    string partyAffil;
    };

//****************************************************************************************************

void getData(President pres);
void outputPresident(President pres);

//****************************************************************************************************


int main()
{
    President pres;
    
    getData(pres);
    
    return 0;
}

//****************************************************************************************************

void getData(President pres)
{
    fstream pData;
    pData.open("pres_data.txt",ios::in);
    do {
        getline(pData, pres.firstName);
        pData >> pres.lastName;
        pData >> pres.beginYear;
        pData >> pres.endYear;
        pData.ignore();
        getline(pData,pres.partyAffil);
        pData.ignore();
        outputPresident(pres);
} while (!pData.eof());
}
//****************************************************************************************************

void outputPresident(President pres)
{
    fstream outData;
    outData.open("a2output.txt",ios::app);
    
    outData << "Name: " << pres.firstName << " " << pres.lastName << "\n\nEntered Office: "
            << pres.beginYear << "\n\nLeft Office: " << pres.endYear << "\n\nParty Affiliation: "
    << pres.partyAffil << endl << endl;
}


pres_data.txt file
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
George
Washington
1789
1797
Federalist
James
Madison
1809
1817
Democratic-Republican
Andrew
Jackson
1829
1837
Democrat
William Henry
Harrison
1841
1841
Whig
Franklin
Pierce
1853
1857
Democrat
Abraham
Lincoln
1861
1865
Republican
Ulysses S.
Grant
1869
1877
Republican
Grover
Cleveland
1893
1897
Democrat
William Howard
Taft
1909
1913
Republican
Herbert
Hoover
1929
1933
Republican
Dwight D.
Eisenhower
1953
1961
Republican
Richard
Nixon
1969
1974
Republican
William Jefferson
Clinton
1993
2001
Democrat
Topic archived. No new replies allowed.