doesn't give error but doesn't work either.

the problem occured after i wrote lines 34-39

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
36
37
38
39
40
41
42
43
44
45
46
float mainpress,maintemp,mainpow,allvariables,mindist=100000,diff;
	vector<float> list;
	vector<float>presslist;
	vector<float>templist;
	vector<float>powerlist;
	vector<float>difflist;
	ifstream myfile ("example.txt");
	int j,i,predicted,neighbour;
	
		for( j=0;j<7500;j++)
		{	myfile >> allvariables;
	list.push_back(allvariables);}
	for( j=0;j<7500;j++)
		{	int div,mod=j%3;
			div=j/3+1;
			if(mod==0){
				maintemp=list.at(j) ;
				templist.push_back(maintemp) ;	}		
			if(mod==1){
				mainpress = list.at(j) ;	
				presslist.push_back(mainpress);}
			if(mod==2){
				mainpow= list.at(j);
				powerlist.push_back (mainpow);}}

	for(i=0;i<2500;i++){
		for(j=0;j<2500;j++){
			if(i==j)
				diff=1000000;
			diff=((templist.at(i)-templist.at(j))*(templist.at(i)-templist.at(j)))+((presslist.at(i)-presslist.at(j))*(presslist.at(i)-presslist.at(j)));
			diff=sqrt(diff);
			difflist.push_back(diff);
		}}
	for(i=0;i<6250000;i++){		
			if(difflist.at(i)<mindist){
			mindist=difflist.at(i);
			predicted=i/2500;
			neighbour=i-(predicted*2500)+1;			
			}}
	powerlist.at(predicted)=powerlist.at(neighbour);
ofstream yourfile;
yourfile.open("power.txt");
for(i=0;i<2500;i++){
	yourfile << powerlist.at(predicted)<<"\n";}   
    myfile.close();	
How do you know it doesn't work?
no output comes. ı wrote for a test line
cout<< "hello"; and it didn't come to the output screen
Topic archived. No new replies allowed.