0

So, I have to write a program that calculates the five number summary of a .txt file with 2 columns and n rows. A snippet of the file would be

23 7.8

27 17.8

39 26.5

41 27.2

From this I am trying to input the numbers into a vector so I can manipulate them. I am new to vectors and am not sure what I am doing wrong. But, so far here is my code

```
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
struct five {
float column1, column2;
friend istream& operator >> ( istream& ins, five& r);
};
istream& operator >> (istream& ins, five& r) {
ins >> r.column1 >> r.column2;
return ins;
}
void main(){
ifstream input;
input.open("data.txt");
if (input.is_open() ){
vector<five> data;
five datam;
while (!input.eof() ) {
input >> datam;
data.push_back (datam);
}
}
```

I have tried reading tutorials about it, but I still cant figure out what I am doing wrong. For example how do I verify that the input is being assigned correctly to the vector for output, and how would I write a statement to manipulate the data to calculate the mean lets say.

Thanks for the help!