Simly c++ question

Hello everybody :) I have a really simply C++ question.
I have a txt file which decribes geometric shapes name and the cordinates
First number describes how many corrdinates are in that line for example first line is 6 so there are 6 coordnates and so on
Tr1 6 1.5 -5.5 5 -1.4 8.5 -5.2
Circ3 3 5.5 -5.5 10
Sq4 8 -3.5 -0.5 -3.5 5.4 2.4 5.4 2.4 -0.5

And i need to calculate how many figures I have and to writte their names.
So how I neet do do it? Here's my reading code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int circles = 0; // how many circles
while(!fd.eof()){
		fd >> name >> n; // n how many coordinates in that line
		f.SetName(name);
		f.SetN(n);

		if(n==3){
			fd >> x >> y >> s;
			f.SetCircle(0, x, y, s);
			circles++; // add circles number by 1

		}else
		for(int i=0; i<n/2; i++){
			fd >> x >> y;
			f.SetKord(i, x, y);
		}
			fgk.Set(f);	
	}

	fd.close();
}

Thanks for Your's answers :)
Any ideas? :)
?
If all you need is how many figures and what their names are, why do you even need the coordinates? Obviously you have three figures: a triangle, a circle, and a square.
Last edited on
No, coordinates will be neccesary in the future.
Topic archived. No new replies allowed.