Big problem! C++

Hello, I have really serious problem on my programm
I have a 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

Here's my code voidIvesti function is OK. Problem are on void Spausdinti. I know that ts.Imti() is bad for cikle
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
void Ivesti(Taskas & ts, const char CD[CMax], int & sk){
	double xkoordinate, ykoordinate; // koordinates x ir y
	string pavadinimas; // figuros pavadinias
	int spindulys;
	
	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 if(sk/2>=2){
			fd >> xkoordinate >> ykoordinate;
			ts.Deti(Figura(pavadinimas, xkoordinate, ykoordinate));
			//cout << pavadinimas << " " << xkoordinate << " " << ykoordinate << endl;
			}
		}
		fd.ignore();
	}
	fd.close();
}
void KokiuIrKiek(Taskas & ts, int sk){

}
void Spausdinti(Taskas & ts, int sk){
	for(int i=0; i<ts.Imti(); i++){ // ts.Immti() is not good because i need to check if my coordinates/2<2. and ts.Imti()=8!!! I need to turn my cikle to 6 (because it is the first number on txt file  andso on) So how I need to do it?
		if(ts.Imti()/2<2){
		cout << ts.Imti(i).SpausdintiAp() << endl;
		}else if(ts.Imti()/2>2){
			cout << ts.Imti(i).Spausdinti() << endl;
		}
	}
}
Last edited on

Hello, I have really serious problem on my programm

I'm sorry, but the biggest problem is that you failed to explain what exactly problem you have and what kind of help you seek.

Also I dare to propose avoid using of identifiers in your native language since usually people from other countries will have great difficulty trying to understand what is the program about at all (so there is no great chance they will try to help).
Topic archived. No new replies allowed.