Program won't compile

Pages: 12
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/* File: Lab5.cpp
   Author: Saif Ismail
  Description: This program sorts occupations by salary and calculates average and median salaries.
*/

#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
const int MAX_OCCUPATIONS = 10;

bool openFile(ifstream&);
void sortOccupations(ifstream&);
double calcSalaries(double salary);
void printSalaries( double average, double median);

int main()
{
        char input_file, occupations;   // input file and occupations
        string countries[1];  // input file and country names
        double salary[MAX_OCCUPATIONS];   // number of occupations
        double average, median;
        ifstream input;

        while ( openFile ( input ) )
        {
                sortOccupations ( input );
         }
        if (input.fail() )
        {
                cout << "Input file " << input_file << "does not exist";
        }
        else
                calcSalaries ( salary[MAX_OCCUPATIONS] );
                printSalaries ( average, median );
        return ( 0 );
}

/* openFile: prompts user for input file, 3 tries

Parameters:

input: ifstream object (input file)

Returns: true if input file is successfully opened

*/

bool openFile(ifstream&)

{

        char input_file[81];  // the input file used to get the data

        string occupations[MAX_OCCUPATIONS];

        double salary[MAX_OCCUPATIONS];

        int attempts = 0;       // number of tries ti open the file

        ifstream input;


        // prompt for input file

        cout << "Enter the name of the input file\n";

        cin.getline(input_file, 81);

        input.open( input_file );

        attempts++;


        while ( input.fail() && attempts < 3 )

        {

              cout << "Could not open file. Enter the name of the input file\n";

              cin.getline(input_file, 81);

              input.open( input_file );

               attempts++;

        }

        if ( input.fail() )

        {

        return false;

        }
        for( int i = 0; !input.eof(); i++)
        {
        input >> occupations[i];
        input >> salary[i];
        }

}


/* sortOccupations: sorts the occupations into a table

Pre-conditions:

The input file was opened successfully

Parameters:

input: ifstream object (input file)

Returns: Nothing

*/

void sortOccupations(ifstream& in)

{

        double salary;

        string occupations;

        int index_of_next_smallest, index_of_smallest, number_used;

        int a;

        for ( int index = 0; index < number_used - 1; index++)
        {
        for ( int i= index + 1; i<index; i++)

        if( index_of_smallest < index_of_next_smallest)
        {
                index_of_next_smallest = index_of_smallest;
        }

 swap(index_of_smallest, index_of_next_smallest);
        }
        //set precision

        cout.setf( ios::fixed | ios::showpoint );

        cout.precision( 2 );


        cout << "Occupations Salary\n";

        cout << "____________________\n";

        cin >> occupations >> salary;

        while ( !in.eof() )

   {

        cout << setw(19) << occupations << " $" << setw(10) << salary << endl;

        cin >> occupations >> salary;

        }

        cout << endl;

}


/* calcSalaries: calculates the median and the average of the salaries

Pre-conditions:

The input file was opened successfully.

Parameters:

salary: used to calculate average and median

Returns: Average and median of salaries

*/

double calcSalaries(double salary[MAX_OCCUPATIONS])

{

        double average;

        double median;

        double total, salary[MAX_OCCUPATIONS];

        int n;

        
        for (int i=0; i < 9; i++)

        {

        total = total + salary[i];

        }

        average = total / salary;


        if(n%2 == 0)

        {

        int middle = n / 2;

        int middle1 = (n / 2)-1;

        median = (salary[middle] + salary[middle1]) / 2;

        }

        return average, median;
}

/* printSalaries: Prints out the average and median into occupations.out

   Pre-conditions:

        Input file was opened succesfully

   Parameters:

        average: average of salaries

        median: median of salaries

   Returns: Nothing

*/

void printSalaries( double average, double median )

{
        double average, median;

        ifstream output;

        // write to output file

        output.open( "occupations.out" );

        output << "Average salary: $ " << average << endl;

         output << "Median salary: $ " << median << endl;

        output.close ( );

        return(0);

}


My program wont compile. These are the errors Im getting:
lab5.cpp: In function 'double calcSalaries(double*)':
lab5.cpp:226: error: declaration of 'double salary [10]' shadows a parameter
lab5.cpp:240: error: invalid operands of types 'double' and 'double [10]' to binary 'operator/'
lab5.cpp: In function 'void printSalaries(double, double)':
lab5.cpp:280: error: 'output' was not declared in this scope
lab5.cpp:288: error: return-statement with a value, in function returning 'void'
I dont know how to fix it. any ideas?
I fixed all those errors now i am getting this:
/tmp/cc204D33.o: In function `main':
lab5.cpp:(.text+0x103): undefined reference to `calcSalaries(double)'
collect2: ld returned 1 exit status
lab5.cpp:(.text+0x103): undefined reference to `calcSalaries(double)'


This literaly means that you have a "reference" in your function header that does not add up to the implementation. Your defenition say's the following:
double calcSalaries(double salary);

As parameter you say it requires a data type of double, however when you call the the function in your main it say's:
calcSalaries ( salary[MAX_OCCUPATIONS] );

In C++ an array is also a pointer! More modern programming languages like JAVA actually do this under water as well. The correct defenition for this function would be:
double calcSalaries(double *salary);
Thanks i cant believe i missed that, but now an error comes up that says:
lab5.cpp: In function 'int main()':
lab5.cpp:35: error: cannot convert 'double' to 'double*' for argument '1' to 'double calcSalaries(double*)'
It compiled but it goes blank after you enter an input file name
Good morning and hello again! I am glad you've managed to solve some of your problems but it would really make it a lot easier for people to help you if you would update the above code model to fit your most recent problem. I don't have the time right now to solve all the individual errors that pop up ;)

So for now I can give my best guess:
I "think" that the file simply cannot be opened. You do have a check that using fail() which only checks if there is an error in ths stream ( see http://en.cppreference.com/w/cpp/io/basic_ios/fail ). You need to see if the file is actually open and can be read from/written to. A common mistake with windows is that files are named myfile.txt.txt. I recommend that you look at: http://en.cppreference.com/w/cpp/io/basic_ifstream/open.
1
2
3
4
5
6
double calcSalaries(double salary);

int main(){
  double salary[MAX_OCCUPATIONS];   // number of occupations
  ..
  calcSalaries ( salary[MAX_OCCUPATIONS] );

..
}[/code]
What do we do here? Main reserves MAX_OCCUPATIONS doubles from stack and calls its location "salary". calcSalaries dereferences the double from location salary+MAX_OCCUPATIONS, which is just outside reserved area, so an error. The call to calcSalaries with a double is fine, according to the declaration of that function, but I bet it is not what is intended.


The "undefined reference" error was about a mismatch:
1
2
3
4
5
double calcSalaries(double salary);

double calcSalaries( double salary[MAX_OCCUPATIONS] ) {
..
}

There is one declaration for calcSalaries, which takes a double, but no definition for that function.
There is one definition for calcSalaries, that takes an array of doubles, but no declaration.
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
/* File: Lab5.cpp
   Author: Saif Ismail
  Description: This program sorts occupations by salary and calculates average and median salaries.
*/

#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
const int MAX_OCCUPATIONS = 10;

bool openFile(ifstream&);
void sortOccupations(ifstream&);
double calcSalaries(double salary[MAX_OCCUPATIONS]);
void printSalaries( double average, double median);

int main()
{
        char input_file, occupations;   // input file and occupations
        string countries[1];  // input file and country names
        double salary[MAX_OCCUPATIONS];   // number of occupations
        double average, median;
        ifstream input;

        while ( openFile ( input ) )
        {
                sortOccupations ( input );
          }
        if (input.fail() )
        {
                cout << "Input file " << input_file << "does not exist";
        }
        else
                calcSalaries ( salary );
                printSalaries ( average, median );
        return ( 0 );
}

/* openFile: prompts user for input file, 3 tries
   Parameters:
       input: ifstream object (input file)
   Returns: true if input file is successfully opened
*/
bool openFile(ifstream&)
{
        char input_file[81];  // the input file used to get the data
        string occupations[MAX_OCCUPATIONS];
        double salary[MAX_OCCUPATIONS];
        int attempts = 0;       // number of tries ti open the file
        ifstream input;

        // prompt for input file
        cout << "Enter the name of the input file\n";
        cin.getline(input_file, 81);
        input.open( input_file );
         attempts++;

        while ( input.fail() && attempts < 3 )
        {
                cout << "Could not open file. Enter the name of the input file\n";
                cin.getline(input_file, 81);
                input.open( input_file );
                attempts++;
        }
        if ( input.fail() )
        {
                return false;
        }
        for( int i = 0; !input.eof(); i++)
        {
                input >> occupations[i];
                input >> salary[i];
        }
}

/* sortOccupations: sorts the occupations into a table
   Pre-conditions:
        The input file was opened successfully
   Parameters:
        input: ifstream object (input file)
   Returns: Nothing
*/
void sortOccupations(ifstream& in)
{
        double salary;
        string occupations;
        int index_of_next_smallest, index_of_smallest, number_used;
        int a;
        for ( int index = 0; index < number_used - 1; index++)
        {
        for ( int i= index + 1; i<index; i++)
        if( index_of_smallest < index_of_next_smallest)
        {
                index_of_next_smallest = index_of_smallest;
        }
        swap(index_of_smallest, index_of_next_smallest);
        }

        //set precision
        cout.setf( ios::fixed | ios::showpoint );
        cout.precision( 2 );

        cout << "Occupations Salary\n";
        cout << "____________________\n";
        cin >> occupations >> salary;
        while ( !in.eof() )
        {
                cout << setw(19) << occupations << " $" << setw(10) << salary << endl;
                cin >> occupations >> salary;
        }
        cout << endl;
}

/* calcSalaries: calculates the median and the average of the salaries
   Pre-conditions:
        The input file was opened successfully.
   Parameters:
        salary: used to calculate average and median
   Returns: Average and median of salaries
*/
double calcSalaries(double salary[MAX_OCCUPATIONS])
{
        double average;
        double median;
        double total;
        int n;

        for (int i=0; i < 9; i++)
        {
                total = total + salary[i];
        }
        average = total / salary[MAX_OCCUPATIONS];
        if(n%2 == 0)
        {
                int middle = n / 2;
                int middle1 = (n / 2)-1;
                median = (salary[middle] + salary[middle1]) / 2;
        }
        return average, median;
}

/* printSalaries: Prints out the average and median into occupations.out
   Pre-conditions:
        Input file was opened succesfully
   Parameters:
        average: average of salaries
        median: median of salaries
   Returns: Nothing
*/
void printSalaries( double average, double median )
{
        ofstream output;

        // write to output file
        output.open( "occupations.out" );
        output << "Average salary: $ " << average << endl;
        output << "Median salary: $ "<< median << endl;
        output.close ( );
}


It compiles but, when the program runs it goes blank after the user enters an input file.
Its supposed to take the information from the input file and sort it. then it prints that information in a table into an output file with the average and median of the info.
how do i check if the file is actually open. your 2nd link is messed up.
Hey, it has been a while. This site has sort of disappeared to the background for me. I don't know if you have already solved the problem but I might still be able to help.

The correct link is: http://en.cppreference.com/w/cpp/io/basic_ifstream/is_open

I have applied this into you're code as the following:
1
2
3
4
5
6
7
        while ( !input.is_open() || attempts > 2)
        {
                cout << "Could not open file. Enter the name of the input file\n";
                cin.getline(input_file, 81);
                input.open( input_file );
                attempts++;
        }


After this the program runs smoothly for me. However at the following code you are asking for input and then couting that in the correct value. You are however no longer using the file which you gave as input so the end of file is never reached.

1
2
3
        cin >> occupations >> salary;
        while ( !in.eof() ) { /* code */ }
        cout << endl;


The program kinda "works" if you manualy insert your strings into the program. If you have any more questions feel free to post or PM if it's urgent.
I wrote the same code again but with a structure in it and i cant get it to compile. any ideas

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
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
const int MAX_OCCUPATIONS = 10;

bool openFile( ifstream& in );
void sortOccupations( occupation myOccupations );
double calcSalaries( double myOccupations.salary[MAX_OCCUPATIONS] );
void printSalaries( occupation myOccupations, double average, double median );

struct occupation
{
char jobs[MAX_OCCUPATIONS][31];   // titles of occupations and number of occupations
double salary[MAX_OCCUPATIONS];  //   salary per occupations
};

int main()
{
        occupation myOccupations;
        char input_file[50];
        double average, median;  // average and median of all the salaries
        ifstream in;  // input file
         
        while( openFile( input ) )
        {
                sortOccupations( myOccupations );
        }
        calcSalaries( myOccupations.salary );
        printSalaries( myOccupations, average, median );
        return( 0 );
}

/* openFile: prompts user for file and loads structure
   Parameters:
in: ifstream object
   Returns: true if input file is successfully opened
*/
bool openFile( ifstream& in )
{
        occupation myOccupations; // structure where info is put in
        char input_file[50];  // input file used to get info
        int i;

        // prompt for input file
        cout << "Enter the name of the input file\n";
        cin.getline( input_file, 50 );
        input.open( input_file );

        if( input.fail() )
        {
              cout << "Input file " << input_file << "does not exist\n";
              return false;
        }
        while( i < MAX_OCCUPATIONS && !input.eof() )
        {
                in.get( myOccupations.jobs[i] );
                in.get( myOccupations.salary[i] );
        }
}

/* sortOccupations: sorts occupations and puts them in a table
   Parameters:
        myOccupations: structure that holds all the info
   Pre-conditions
        Input file was successfully opened
   Returns nothing
*/
void sortOccupations( occupation myOccupations )
{
        int top, min, temp, i;
        ifstream in;

        // sort occupations
        for( top = 0; top < myOccupations.jobs[i] - 1; top++ )
        {
                min = top;
                for( i = top + 1; i < myOccupations.jobs[i]; i++ )
                {
                        if( myOccupations.jobs[min] > myOccupations.jobs[i] )
                        {
                                min = 1;
                        }
                }
                swap( temp, myOccupations.jobs[top] );
                swap( myOccupations.jobs[top], myOccupations.jobs[min] );
                myOccupations.jobs[min] = temp;
        }

        // put info in table
        while( myOccupations.jobs[i] < MAX_OCCUPATIONS )
        {
        cout << setw(11) << myOccupations.jobs[i] << "     $" << setw(11) << myOccupations.salary[$
        in >> myOccupations.jobs[i] >> myOccupations.salary[i];
        }
}

/* calcSalaries: calculates average and median of salaries
   Parameters:
        myOccupations.salary: salary of each profession
   Pre-Conditions
        structure has been loaded with information
   Returns: average and median of salaries
*/
double calcSalaries( double myOccupations.salary[MAX_OCCUPATIONS] )
{
        double average, median, total;
         int n, middle, middle1;

        for( int j = 0; j < MAX_OCCUPATIONS; j++ )
        {
                total = total + myOccupations.salary[j];
        }
        average = total / myOccupations.salary[j];
        if( n % 2 == 0 )
        {
                middle = n / 2;
                middle1 = (n / 2) - 1;
                median = (myOccupations.salary[middle] + myOccupations.salary[middle1]) / 2;
        }
        else
                middle = n / 2;
                median = myOccupations.salary[median] + 0.5;
}

/* printSalaries: prints the average and median into output file
   Parameters:
        myOccupations: structure with info
        average: average of salaries
        median: median of salaries
   Pre-conditions:
        average and median were successfully calculated
   Returns: nothing
*/
void printSalaries( occupation myOccupations, double average, double median )
{
        ofstream out;

        // write to output file
        out.open( "occupations.out" );
        out << "Average salary: $ " << average << endl;
        out << "Median salary: $ "<< median << endl;
        out.close ( );
}
saifismail03 wrote:
I wrote the same code again but with a structure in it and i cant get it to compile.

What errors does the compiler list?

That lines 8 and 10 use unknown typename "occupation"?
That line 9 has an illegal '.' in parameter-name "myOccupations.salary"?
That line 25 uses unknown name "input"?
That on line 57 get() does not know parameter type "char [31]"?
...
We are now in the annoying situation where there are 2 topics about the same problem. People replying are asking the same things. Annoying because pretty comprehensive answers were given in the other one, and it wastes people's time.

http://www.cplusplus.com/forum/beginner/101006/


If you have problems with the same code, then just keep 1 topic going.
here is my updated code:

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
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
const int MAX_OCCUPATIONS = 10;

struct occupation
{
char jobs[MAX_OCCUPATIONS][31];   // titles of occupations and number of occupations
double salary[MAX_OCCUPATIONS];  //   salary per occupations
};

bool openFile( ifstream& in );
void sortOccupations( occupation myOccupations );
double calcSalaries( occupation myOccupations );
void printSalaries( occupation myOccupations, double average, double median );

int main()
{
        occupation myOccupations;
        char input_file[50];
        double average, median;  // average and median of all the salaries
        ifstream in;  // input file

        while( openFile( in ) )
        {
                sortOccupations( myOccupations );
        }
        calcSalaries( myOccupations );
        printSalaries( myOccupations, average, median );
        return( 0 );
}

/* openFile: prompts user for file and loads structure
   Parameters:
        in: ifstream object
   Returns: true if input file is successfully opened
*/
bool openFile( ifstream& in )
{
        occupation myOccupations; // structure where info is put in
        char input_file[50];  // input file used to get info
        int i;

        // prompt for input file
        cout << "Enter the name of the input file\n";
        cin.getline( input_file, 50 );
        in.open( input_file );

        if( in.fail() )
        {
                cout << "Input file " << input_file << "does not exist\n";
                return false;
        }
        while( i < MAX_OCCUPATIONS && !in.eof() )
        {
                in >> ( myOccupations.jobs[i] );
                in >> ( myOccupations.salary[i] );
        }
        return true;
}

/* sortOccupations: sorts occupations and puts them in a table
   Parameters:
        myOccupations: structure that holds all the info
   Pre-conditions
        Input file was successfully opened
   Returns nothing
*/
void sortOccupations( occupation myOccupations )
{
        int top, min, temp, i;
        ifstream in;

        // sort occupations
        for( top = 0; top < myOccupations.jobs[i] - 1; top++ )
        {
                min = top;
                for( i = top + 1; i < myOccupations.jobs[i]; i++ )
                {
                      if( myOccupations.jobs[min] > myOccupations.jobs[i] )
                        {
                                min = 1;
                        }
                }
                swap( temp, myOccupations.jobs[top] );
                myOccupations.jobs[top] = myOccupations.jobs[min];
                myOccupations.jobs[min] = temp;
        }

        // put info in table
        while( myOccupations.jobs[i] < MAX_OCCUPATIONS )
        {
        cout << setw(11) << myOccupations.jobs[i] << "     $" << setw(11) << myOccupations.salary[i] << endl;
        in >> myOccupations.jobs[i] >> myOccupations.salary[i];
        }
}

/* calcSalaries: calculates average and median of salaries
   Parameters:
        myOccupations: structure with info
   Pre-Conditions
        structure has been loaded with information
   Returns: average and median of salaries
*/
double calcSalaries( occupation myOccupations )
{
        double average, median, total;
        int n, j, middle, middle1;

        for( j = 0; j < MAX_OCCUPATIONS; j++ )
        {
                total += myOccupations.salary[j];
        }
        average = total / myOccupations.salary[j];
        if( n % 2 == 0 )
        {
                middle = n / 2;
                middle1 = (n / 2) - 1;
                median = (myOccupations.salary[middle] + myOccupations.salary[middle1]) / 2;
        }
        else
                 middle = n / 2;
                median = myOccupations.salary[middle] + 0.5;
}

/* printSalaries: prints the average and median into output file
   Parameters:
        myOccupations: structure with info
        average: average of salaries
        median: median of salaries
   Pre-conditions:
        average and median were successfully calculated
   Returns: nothing
*/
void printSalaries( occupation myOccupations, double average, double median )
{
        ofstream out;

        // write to output file
        out.open( "occupations.out" );
        out << "Average salary: $ " << average << endl;
        out << "Median salary: $ "<< median << endl;
        out.close ( );
}


these are the errors im now getting:
1
2
3
4
5
6
7
lab7.cpp: In function 'void sortOccupations(occupation)':
lab7.cpp:81: error: ISO C++ forbids comparison between pointer and integer
lab7.cpp:84: error: ISO C++ forbids comparison between pointer and integer
lab7.cpp:91: error: no matching function for call to 'swap(int&, char [31])'
lab7.cpp:92: error: invalid array assignment
lab7.cpp:93: error: incompatible types in assignment of 'int' to 'char [31]'
lab7.cpp:97: error: ISO C++ forbids comparison between pointer and integer
Did you read all of what I said in the other topic?

http://www.cplusplus.com/forum/beginner/101006/#msg543092


I covered all those things.

Also read what the other people said in that topic.
No one covered thos errors in any of the topics.
can u please help me out?
I did, more like you didn't understand what was said.

Which part didn't you get?
Perhaps he means the int-pointer comparison error? The error message tells quite clearly what is wrong there. However, even if syntax were correct, I predict logical error and undefined behaviour in at least one of them.
@keskiverto

Hi,

I gave advice about that - I said use std::string and not char arrays :)

The other intriguing one was not to use 2 swap + assignment to implement 1 swap !! Hopefully the OP realises that swap is not the same as assignment.

Have a good weekend all !
Thanks for all the help but now im getting these errors:

1
2
3
4
5
6
7
8
lab7.cpp: In function 'bool openFile(std::ifstream&)':
lab7.cpp:63: error: invalid operands of types '<unresolved overloaded function type>' and 'std::string [31]' to binary 'operator>>'
lab7.cpp:64: error: invalid operands of types '<unresolved overloaded function type>' and 'double' to binary 'operator>>'
lab7.cpp: In function 'void sortOccupations(occupation)':
lab7.cpp:93: error: invalid array assignment
lab7.cpp:94: error: invalid array assignment
lab7.cpp:99: error: invalid operands of types '<unresolved overloaded function type>' and 'std::string [31]' to binary 'operator>>'
Pages: 12