Separating .txt Lines Into Different Variables

I'm trying to find a way to read a .txt file and take each line of it and store it in a variable to manipulate each section later. The text file looks like this,
900 900 <- display size
3 <- number of sides
400 0 <- point 1
746 600 <- point 2
54 600 <- point 3

Each line has the coordinates of a point.
Right now I just have a simple reader set up like this,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <fstream>
using namespace std;

  int main (int argc, char* argv[]) {
  string line;
  string filename = "triangle.txt";
  ifstream reader(filename);
  while (getline(reader,line)) {
    cout << line << endl;
  }
  reader.close();

return 0;
}


I will need to be able to find the midpoint between point 1 and 2, 2 and 3, and 3 and 1. I don't know if I'm on track for what I want to do. Thanks.
> 3 <- number of sides
What's the significance of this number?
It it always 3, or can it be other numbers like 2, 5, 10, 100?

> Each line has the coordinates of a point.
Do you know about structures, is this OK or completely mysterious to you?
1
2
3
struct Point {
  int x, y;
};


What about this?
 
vector<Point> triangle(3);  // a triangle has 3 points 
Topic archived. No new replies allowed.