Why my program read files incorrect

Hello i have a really seriuos problem. My program reads files incorrect Why?
Here's my txt file
Tr1 6 1.5 -5.5 5 -1.4 8.5 -5.2
Aps3 3 5.5 -5.5 10
Kt4 8 -3.5 -0.5 -3.5 5.4 2.4 5.4 2.4 -0.5

And here's my main void function

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void Ivesti(Taskas & ts, const char CD[CMax], int & sk){
	double xkoordinate, ykoordinate; // koordinates x ir y
	string pavadinimas; // figuros pavadinias
	int spindulys=0;
	
	ifstream fd(CD);
	while(!fd.eof()){
		fd >> pavadinimas >> sk;
		for(int i=0; i<sk/2; i++){
			if(sk/2<2){
				fd >> xkoordinate >> ykoordinate >> spindulys;
				ts.Deti(Figura(pavadinimas, xkoordinate, ykoordinate, spindulys));
				cout << pavadinimas << " " << xkoordinate << " " << ykoordinate << " " << spindulys << endl;
			}else
			fd >> xkoordinate >> ykoordinate;
			ts.Deti(Figura(pavadinimas, xkoordinate, ykoordinate));
			cout << pavadinimas << " " << xkoordinate << " " << ykoordinate << endl;
		}
		fd.ignore();
	}
	fd.close();
}

So why my program get these results? http://imgur.com/edit
why not just post your output here ?
Ok SamuelAdams, I have uppladed all my program there http://www3.zippyshare.com/v/36863429/file.html

Oh, Finally I find the mistake. But now i need to know how I need to print files with function Spausdinti()?
Last edited on
Topic archived. No new replies allowed.