I/O program major issues

NO LONGER "major issues". I have completed the core part of the program and need assistance to figure the rest out. I'm at a complete loss due to teacher and book not really covering material in a way to prepare for the assignment. I have looked over the tutorials for I/O on this site as well as others and if I need to change things, I'm wide open for assistance. I did attempt to figure out as much as I could, but I'm stuck. Thanks in advance for anyone who takes time to assist me. I greatly appreciate it.

To clear things up from the start, here are the instructions:

The program is to take a text file, students.txt, containing information about the currently-enrolled students in a school. Each
line represents a record for a different student and contains the student's identification number (eight digits), credit hours
completed, and grade point average. A sample line follows:

10082352 66 3.04

Program is supposed to have the identification number and grade point average for each student in the file copied to one of four
different text files based on the number of credit hours completed:

Less than 32 freshmen.txt
32 to 63 sophomores.txt
64 to 95 juniors.txt
96 or more seniors.txt

Next is to write the identification number and grade point average of each student on a single line (one line per student) in the
appropriate file. For example, since the student mentioned above has completed 66 credit hours, the following would be
added to the file juniors.txt:

10082352 3.04


The number of students in the original file is unknown, so the program will need to read these records in until you reach the end of
the file.

Also, no student should have a negative number of credit hours, and the maximum number of credit
hours that a student can accumulate is 250. If the program encounters a student record with an erroneous number of
credit hours, write the entire record for that student (identification number, credit hours, and grade point average) to the
file hoursError.txt rather than any of the four aforementioned files. The lowest grade point average a student may have is 0.0, and the highest grade point average a
student may have is 4.0. If the program encounters a student record with an erroneous grade point average, write the
entire record for that student to the file averageError.txt rather than any of the four aforementioned files.As was previously stated, the student's identification number should be eight digits. If the program
encounters a student record with an identification number of fewer or greater than eight digits, write the entire record for
that student to the file identError.txt rather than any of the four aforementioned files.Assume that an identification number error has highest precedence, then the
number of credit hours completed, then the grade point average. Don't write a student record to multiple error files: only
the one that has the highest precedence should receive the record.

I'm going in the direction that I believe it needs to have the input file made into a dynamic array, but not sure how to do that.

Here is the code I have with compiler errors formatted within brackets after comment code. e.g. //[compiler error]

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
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;

/** [ I get the "unknown size" error on all of these b/c I don't know how to assign them ] */

int studentID[];
int creditHours[];
double gpa[];


int main()
{

int studentID[]; 
int creditHours[]; 
int gpa[];
ifstream students; 
ofstream freshman, sophomores, juniors, seniors; 


ifstream in_stream;
in_stream.open("students.txt");

if (in_stream.fail())
{
cout<< "Input file opening failed.\n";
exit(1);
}

ofstream out_stream;
out_stream.open("freshmen.txt");
out_stream.open("sophomores.txt");
out_stream.open("juniors.txt");
out_stream.open("seniors.txt");
out_stream.open("hoursError.txt");
out_stream.open("averageError.txt");
out_stream.open("identError.txt");

if (out_stream.fail())
{
cout<< "Output file opening failed.\n";
exit(1);
}

out_stream.setf(ios::fixed);
out_stream.setf(ios::showpoint);
out_stream.precision(2);

while (!students.eof())
{

void getInput(ifstream students, int &studentID, int &creditHours, int &gpa);

}


/** [ error C2446: '<' : no conversion from 'int *' to 'int' There is no context in which this conversion is possible ] & [ error C2040: '<' : 'int' differs in levels of indirection from 'int []' ] */

for (int i=0; i < studentID; i++)
out_stream << studentID[i] << creditHours[i] << gpa[i] << endl;


in_stream.close();
out_stream.close();
}



/** [ error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ]*/

getInput(ifstream students, int &studentID, int &creditHours, int &gpa); 

// [ error C2447: '{' : missing function header (old-style formal list?) ]
{ 
    int i = 0; 
        while(!students.eof()) 
        { 
       students >> &studentID[i] >> &creditHours[i] >> &gpa[i]; 
       cout << studentID[i] << creditHours[i] << gpa[i] << endl; 
           i++; 
        } 
return;

}



Thanks again for anyone who has patience to assist me. It's greatly appreciated.
Last edited on
-from line 9-
1
2
3
int studentID[];
int creditHours[];
double gpa[];
The compiler must know the size of an array:
1
2
3
int aray[5]; // size specified
int array[5] = { 1, 2, 3, 4, 5 }; // size and values specified
int aray[] = { 1, 2, 3, 4, 5 }; // size implicitly defined by the number of values 

-from line 17-
1
2
3
int studentID[]; 
int creditHours[]; 
int gpa[];
You already declare these as global, you need to do this only once

-line 62-
 
for (int i=0; i < studentID; i++)
studentID was declared as an array, not a single int

-line 74-
1
2
3
/*missing function return type specifier ( void )*/getInput(ifstream students, int &studentID, int &creditHours, int &gpa); // extra semicolon

{

-line 81-
 
students >> &studentID[i] >> &creditHours[i] >> &gpa[i];
You have reference as parameters and here are using them as arrays. Furthermore, you are reading passing the memory location of the (i-1)th element of the array instead of the element itself



Last edited on
I'm going to try and break things down and do them step by step. Here is the code I'm trying to use to open the input file, students.txt, and just a single output file, freshmen.txt. I also want ot count the number of lines in the students.txt file. Can someone tell me if I'm on the right track please? My book said that if the output file didn't exist, the program would create it, but it isn't doing that nor when I create a file does it print anything to the file. There isn't anything showing up on the compiler screen other than it saying that there wasn't any errors.

As in my first post, I would like to be able to open the students.txt file and then sort its elements into different output files based on certain criteria is why I have the other open output file code, but I can't get just the one output file right now.

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
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;


int main()
{
 int elements;          

ifstream students;
ifstream open("students.txt");

if (students.fail())
{
cout<< "Input file opening failed.\n";
exit(1);
}
 students >> elements;        
     while (!students.eof( ))      
     {
          cout<<elements<<endl;    
          students >> elements;         
     }


ofstream freshmen;
  freshmen.open ("freshmen.txt");
  /**
ofstream sophomores;
  sophomores.open ("sophomores.txt);
ofstream juniors;
  juniors.open ("juniors.txt");
ofstream seniors;
  seniors.open ("seniors.txt");
*/
if (freshmen.fail()/**, sophomores.fail(), juniors.fail(), seniors.fail()*/)
{
cout<< "Output file opening failed.\n";
exit(1);
}
}



Also, someone on another site suggested :

read the integers in a char array and then convert and break into int.
you need to create dynamic array of integers because you do not know the number of records.

when you have the number of record through the above mentioned process.then create a array like this.
1
2
3
4
5
\\lets say count(int type) has the number of  variables

int *dynarray= new int[count];

//this is a 1-D dynamic array,this way you wont get the error. 


here is the code to read a line into a char array
1
2
3
4
5
6
7
8

char carray[10];

ifstream in("filename.txt");

in.getline(carray,10);   //read a line(of 10 chars) into carray



then break the read line and get your values.



However, after looking on the net, there are similar programs (very few) that use vectors instead of an array, but I don't know much about nor have experience with them. Any suggestions?
However, after looking on the net, there are similar programs (very few) that use vectors instead of an array, but I don't know much about nor have experience with them. Any suggestions?
Vectors are better than arrays, see http://www.cplusplus.com/reference/stl/vector/

but it isn't doing that nor when I create a file does it print anything to the file
You aren't writing anything to the output file
I have looked over that thread before and yes it does define vectors well and describes theory, but not very well on how to use them. Not anything where I can see how to apply it to my situation.
Last edited on
If you read the various sub-articles you will find some code examples. A vector is the same as a resizable array
after a more work (what I could get in between work and school), here is the updated post. All post before this can be pushed to the side / ignored b/c I have re-wrote my code and coming in again. lol. Thanks for input Bazzy. Will look into it more.

Figure I might as well go ahead and clear up that this is obviously a school assignment. I have completed a somewhat decent amount of code (not saying I have a lot of faith in it's correctness tho) and need assistance to figure the rest out. I'm at a complete loss due to teacher and book not really covering material in a way to prepare for the assignment. I have looked over the tutorials for I/O on this site as well as others and if I need to change things, I'm wide open for assistance. I did attempt to figure out as much as I could, but I'm stuck. Thanks in advance for anyone who takes time to assist me. I greatly appreciate it.

To clear things up from the start, here are the instructions:

The program is to take a text file, students.txt, containing information about the currently-enrolled students in a school. Each
line represents a record for a different student and contains the student's identification number (eight digits), credit hours
completed, and grade point average. A sample line follows:

10082352 66 3.04

Program is supposed to have the identification number and grade point average for each student in the file copied to one of four
different text files based on the number of credit hours completed:

Less than 32 freshmen.txt
32 to 63 sophomores.txt
64 to 95 juniors.txt
96 or more seniors.txt

Next is to write the identification number and grade point average of each student on a single line (one line per student) in the
appropriate file. For example, since the student mentioned above has completed 66 credit hours, the following would be
added to the file juniors.txt:

10082352 3.04


The number of students in the original file is unknown, so the program will need to read these records in until you reach the end of
the file.

Also, no student should have a negative number of credit hours, and the maximum number of credit
hours that a student can accumulate is 250. If the program encounters a student record with an erroneous number of
credit hours, write the entire record for that student (identification number, credit hours, and grade point average) to the
file hoursError.txt rather than any of the four aforementioned files. The lowest grade point average a student may have is 0.0, and the highest grade point average a
student may have is 4.0. If the program encounters a student record with an erroneous grade point average, write the
entire record for that student to the file averageError.txt rather than any of the four aforementioned files.As was previously stated, the student's identification number should be eight digits. If the program
encounters a student record with an identification number of fewer or greater than eight digits, write the entire record for
that student to the file identError.txt rather than any of the four aforementioned files.Assume that an identification number error has highest precedence, then the
number of credit hours completed, then the grade point average. Don't write a student record to multiple error files: only
the one that has the highest precedence should receive the record.

I'm going in the direction that I believe it needs to have the input file made into a dynamic array, but not sure how to do that.

I am now at the point that I would need to create an array or vector that would read in the line from students.txt and then be able to sort it to different output files based on the 2nd column of numbers.

ie.
say the line is 10082352 66 3.04

Next is to write the identification number and grade point average of each student on a single line (one line per student) in the
appropriate file.

For example, since the student mentioned above has completed 66 credit hours, the following would be
added to the file juniors.txt based on the criteria for sorting listed in the 1st post:

10082352 3.04


Here is my code thus far

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
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;


int main()
{
      ifstream students("Students.txt");
      if (students.fail())
      {
      cout<< "Input file opening failed.\n";
      exit(1);
      }

      int count=0;
      char carray[1000];
      while (!students.eof())
      {
      students.getline(carray,10000);
      cout << carray <<endl;
      count++;
      }
//just to test and see if loop is working I print it to the console.
      cout << "The number of records found in the file are: " << count << endl;


ofstream freshmen("freshmen.txt");
ofstream sophomores("sophmores.txt");
ofstream juniors("juniors.txt");
ofstream seniors("seniors.txt");

//test to show output file creation and writing are working
if (freshmen.is_open())
  {
    freshmen << "The number of records found in the file are: " << count << endl;
    freshmen.close();
  }
  else cout << "Unable to open file";

}


To clear up where I'm at, I need assistance in figuring out how to get the input file data into either an array or vector and then sort it to its different respective output files.

There is also possibility that the input file may have a student ID with more than 8 numbers as well as the other two columns having a varying number digits in each column (which will also affect which output file it will be sent to).

//Edited to include

not sure exactly how to use it, but could something like

1
2
3
4
 
int studentID[count];
int creditHours[count];
int gpa[count];


work to create an array that will vary based on the number of lines in the file?

//End of edit



Thanks to all who have the patience to assist me.
Last edited on
I believe you should use a struct/class to represent the students
eg:
1
2
3
4
5
6
struct Student
{
     unsigned long ID;
     unsigned creditHours;
     double gpa;
};
Then you should create something like a vector ( or a deque in this case would be more efficient as you don't know the number of the students )
You can read in a loop the various variables from the text and then insert a new student in the deque:
1
2
3
4
5
deque<Student> Students;
//...
Student NextStudent;
// read stuff ...
Students.push_back(NextStudent); //adds a student to the deque 

Then you can sort it with standard algorithms:
http://www.cplusplus.com/reference/algorithm/sort/
So due to this being my 1st class and I don't fully understand all of this, I'm lost. It's due in roughly hours and as can be seen, I'm not even in the testing part to ensure it's working. I've worked on this for roughly 7.5 hrs per night every night for the past 4 days and I just can't wrap my mind around it.

I greatly appreciate the assistance. I have worked with some stuff that was posted on another forum I have this on and placed it within my code where I thought it would go, but even after re-naming, and moving stuff around and other things I can't get it to work. My compiler (VS 2008) didn't want to accept the way they had things "formatted" for lack of better terms so I took out parts so it would remove those errors, but I still can't get them all to work down to where I can follow them through and figure them out.

Here is my code as of now.

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
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <sstream>

using namespace std;


int main()
{
	std::ifstream students("students.txt"); 
	std::string input;

	if (students.fail())
	{
		cout<< "Input file opening failed.\n";
		exit(1);
	}

	int count=0;
	char carray[1000];
	while (!students.eof())
	{
		students.getline(carray,10000);
		count++;
	}

	ofstream freshmen("freshmen.txt");
	ofstream sophomores("sophmores.txt");
	ofstream juniors("juniors.txt"); 
	ofstream seniors("seniors.txt");

	struct student
	{
		int id;
		int hours;
		double grade;
	};

	std::vector<student> my_student;
	my_student.push_back( my_student );
}

while( std::getline(students, input) )
{
	std::string input = "12345678 50 3.2";
	std::istringstream buffer(input);
	int id_number;
	int credit_hours;
	double grade_points;

	if( buffer >> id_number >> credit_hours >> grade_points )
	{



		id = id_number;
		hours = credit_hours;
		grade = grade_points;



	else
	{
		cout<<"Error in processing file.\n";
		exit(1);
	}

	}
}



If anyone can assist further in a way that I might understand since we haven't covered a lot of things thoroughly as we probably should have. This is my 1st class and it's bogging me down (doesn't help that I'm taking Java at the same time tho). I still have roughly 31 hrs till its due from the time of this post, so I will work on it as much as I can.

Thanks again for all the assistance.



Edited to reformat indentation and to move the vector and struct declarations. Still working on the looping against !student. There are so many tutorials that say "use this method" that I can't seem to find one that works. Rather it's accepted by all programmers or not, I just need it to work. lol. I described in the 1st post exactly what I was trying to do and the code that is in this post is what was suggested on another thread but I apparently didn't understand how they wanted me to implement it into my code.

Last edited on
Ugh, your indentation is kind of screwed up, so it's hard to see where scopes begin/end...VC++ 2008 has an "format" thing (Edit->Advanced->Format Selection), select your code and use that and it'll make it look nice.

Lines 15/23, you want to loop against !students, not the eof() or fail().
On line 22, use an std::string, so you can use std::getline() on lines 25/26.
35 and on...
I don't understand what you are trying to do...You are overwriting the data you just got, making a local (named) struct for some reason...maybe you need to re-think how you approaching this.
Both the vector and the struct declarations should be moved before line 34
I have edited my post and put it in bold at the bottom.

Thanks again for your assistance.
You are closing the main brace too early ( Line 43 )
Move it to line 72
- With better indentation, these problems are more visible -
It's due in 6 hours and I don't know if I'm going to be able to get it finished. I wish that he had covered the material better so that I could help myself with the help you are providing. Thanks a lot for all you have done.

Here is the 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
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <sstream>

using namespace std;


int main()
{
	std::ifstream students("students.txt"); 
	std::string input;

	if (students.fail())
	{
		cout<< "Input file opening failed.\n";
		exit(1);
	}

	int count=0;
	char carray[1000];
	while (!students.eof())
	{
		students.getline(carray,10000);
		count++;
	}

	ofstream freshmen("freshmen.txt");
	ofstream sophomores("sophmores.txt");
	ofstream juniors("juniors.txt"); 
	ofstream seniors("seniors.txt");

	struct student
	{
		int id;
		int hours;
		double grade;
	};

	std::vector<student> my_student;
	my_student.push_back( my_student );

while( std::getline(students, input) )
{
	std::string input = "12345678 50 3.2";
	std::istringstream buffer(input);
	int id_number;
	int credit_hours;
	double grade_points;

	if( buffer >> id_number >> credit_hours >> grade_points )
	{



		id = id_number;
		hours = credit_hours;
		grade = grade_points;



	else
	{
		cout<<"Error in processing file.\n";
		exit(1);
	}

	}

	/** code to format output to show the gpa in correct format.
	std::cout.setf(ios::fixed, ios::floatfield);
	std::cout.setf(ios::showpoint);
	std::cout.precision(2);
	*/

	}
}


and these are the errors that I'm getting.


(41) : error C2039: 'vector' : is not a member of 'std'
(41) : error C2065: 'vector' : undeclared identifier
(41) : error C2275: 'main::student' : illegal use of this type as an expression
(35) : see declaration of 'main::student'
(41) : error C2065: 'my_student' : undeclared identifier
(42) : error C2065: 'my_student' : undeclared identifier
(42) : error C2228: left of '.push_back' must have class/struct/union
1> type is ''unknown-type''
(42) : error C2065: 'my_student' : undeclared identifier
(57) : error C2065: 'id' : undeclared identifier
(58) : error C2065: 'hours' : undeclared identifier
(59) : error C2065: 'grade' : undeclared identifier
(63) : error C2181: illegal else without matching if


_

Last edited on
#include <vector>

57
58
59
id = id_number;
hours = credit_hours;
grade = grade_points;
You need to use a student object

41
42
std::vector<student> my_student;
my_student.push_back( my_student );

Remove line 42, you'll need to push a student object after reading it from the file
I removed what was line 42 but don't know where I should put the pushback or otherwise how to use it. I'm looking that and the student object parts up now.

Here is the code with the new #include and the deletion of that line

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
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <sstream>
#include <vector>

using namespace std;


int main()
{
	std::ifstream students("students.txt"); 
	std::string input;

	if (students.fail())
	{
		cout<< "Input file opening failed.\n";
		exit(1);
	}

	int count=0;
	char carray[1000];
	while (!students.eof())
	{
		students.getline(carray,10000);
		count++;
	}

	ofstream freshmen("freshmen.txt");
	ofstream sophomores("sophmores.txt");
	ofstream juniors("juniors.txt"); 
	ofstream seniors("seniors.txt");

	struct student
	{
		int id;
		int hours;
		double grade;
	};

	std::vector<student> my_student;
	

while( std::getline(students, input) )
{
	std::string input = "12345678 50 3.2";
	std::istringstream buffer(input);
	int id_number;
	int credit_hours;
	double grade_points;

	if( buffer >> id_number >> credit_hours >> grade_points )
	{



		id = id_number;
		hours = credit_hours;
		grade = grade_points;



	else
	{
		cout<<"Error in processing file.\n";
		exit(1);
	}

	}

	/** code to format output to show the gpa in correct format.
	std::cout.setf(ios::fixed, ios::floatfield);
	std::cout.setf(ios::showpoint);
	std::cout.precision(2);
	*/

	}
}



And now these are the remaining errors.



(58) : error C2065: 'id' : undeclared identifier
(59) : error C2065: 'hours' : undeclared identifier
(60) : error C2065: 'grade' : undeclared identifier
(64) : error C2181: illegal else without matching if
56
57
58
59
60
61
62
63
64
student stud; // declares an object of student

stud.id = id_number;
stud.hours = credit_hours;
stud.grade = grade_points;

my_student.push_back(stud); // inserts the student in the vector

} // you forgot this 

Last edited on
Thanks a lot. That got it to compile and now to I'm going to work on trying to sort the input into the four output files.

here is the code compiling.

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
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <sstream>
#include <vector>

using namespace std;


int main()
{
	std::ifstream students("students.txt"); 
	std::string input;

	if (students.fail())
	{
		cout<< "Input file opening failed.\n";
		exit(1);
	}

	int count=0;
	char carray[1000];
	while (!students.eof())
	{
		students.getline(carray,10000);
		count++;
	}

	ofstream freshmen("freshmen.txt");
	ofstream sophomores("sophmores.txt");
	ofstream juniors("juniors.txt"); 
	ofstream seniors("seniors.txt");

	struct student
	{
		int id;
		int hours;
		double grade;
	};

	std::vector<student> my_student;


	while( std::getline(students, input) )
	{
		std::string input = "12345678 50 3.2";
		std::istringstream buffer(input);
		int id_number;
		int credit_hours;
		double grade_points;

		if( buffer >> id_number >> credit_hours >> grade_points )
		{
			student stud; 

			stud.id = id_number;
			stud.hours = credit_hours;
			stud.grade = grade_points;

			my_student.push_back(stud);

		}

		else
		{
			cout<<"Error in processing file.\n";
			exit(1);
		}

	}

	/** code to format output to show the gpa in correct format.
	std::cout.setf(ios::fixed, ios::floatfield);
	std::cout.setf(ios::showpoint);
	std::cout.precision(2);
	*/

}
I have looked over the net and the main direction I'm getting to sort the data is to use

sort(my_student.begin(), my_student.end());

but I'm not sure to put it either after the if-else statements or after the getline while loop itself.

I'm getting the error stating that " 'sort': identifier not found " no matter where I place it.


Once i do get that to work, could I create a if-else loop to sort the data into their output files? As long as I can get it to sort into one of the four "classes" output files it will be acceptable (I emailed the prof) but he would prefer if I could also include the sort if one of the errors occurs such as the student ID being more than 8 numbers (I defined the errors in a previous post).

Thanks for all the assistance.
I'm not sure to put it either after the if-else statements or after the getline while loop itself.
You should put it after the while

I'm getting the error stating that " 'sort': identifier not found " no matter where I place it.
You need to #include <algorithm>

I order to use sort, you'll need to define a sorting function.



Topic archived. No new replies allowed.