Hi

I created a code which reads data from user, processes it and write it back in to a file in .csv format so that user can see it in excel.
Although the program is running fine from the tc for any set of data, the exe file when i use directly is not able to write in some of the inputs.
Kinsly suggest a solution for this as i have to post the exe file and not the code to the user.

Akshayy Garg

/*	Author : < snip author's name>
	Contact : <snip email>
	Date of release : 29th Apr. 08
*/

/*
The program gets the activity codes, corresponding FTPs and number of working days.
It then calculates and print the corresponding per day hours in the excel sheet "ILC_code.csv".
It also adds information about the FTP and the hours difference occured due to some approximation.
The difference limit in this program has been set to a max of .1 hr per month.
*/



#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<fstream.h>
#include<process.h>

int nod,noa;
/*
nod : Number of days
noa : Number of activities
*/


//Function to calculte modulus of num
float mod(float num)
{
	if(num<0)
		return -1*num;
	return num;
}

//Function to get round value for num correct to 'place' decimal places
float round(float num,int place)
{
	if(num==0)
		return num;
	float num1=mod(num)-int((num));

	if( fmod(num1*pow(10,place+1),10) >= 4.9999998 )
	{
		return ( (num/mod(num))*( int(mod(num))+ceil(num1*pow(10,place))/(pow(10,place))));
	}
	else
	{
		return ((num/mod(num))*(int(mod(num))+floor(num1*pow(10,place))/(pow(10,place))));
	}

}

class ilc
{
	char activity[7],ap_name[10],pid[10],wi[16];
	float ftp,ftp_pd,*ftp_pdd,ftp_tdd,diff_ftp,change_ftp;

	/*
	activity : Activity Code(Max size 7)
	ap_name  : Application Name(Max size 10)
	pid      : Project ID(Max size 10)
	wi       : Work Item(Max size 10)
	ftp : Full Time Person
	ftp_pd : Hours that has to be claimed every day = ftp*8.
	*ftp_pdd : An array of Hours claimed actually on daily basis.
		The size of array is nod.
	ftp_tdd : Total FTP claimed.
	diff_ftp : Difference in ftp hrs required and actually claimed.
	change_ftp : Difference in the actual FTP and changed FTP for calculation purposes.
	*/
	public:

	static float ftp_total;
	//ftp_total : Total FTP to be claimed(must be equal to 1)

	ilc()
	{
		ftp_pdd=new float[nod];
		ftp_tdd=0;
		change_ftp=0;
	}

	//Function to get Activity code and FTP from user.
	void get_data(void);

	//Function to change ftp_pd ny reducing it by f.
	//It also changes change_ftp, ftp & diff_ftp accordingly
	void change_ftp_pd(float f)
	{
		ftp_pd-=f;
		change_ftp=ftp-(ftp_pd/8);
		ftp=ftp_pd/8;
		diff_ftp=(nod%5)*(change_ftp)*8;
	}

	//Function to change ftp_pdd on 'day; by adding it by diff.
	//It also changes ftp_tdd & diff_ftp accordingly
	void change(int day,float diff)
	{
		ftp_pdd[day-1]+=diff;
		ftp_tdd+=diff;
		diff_ftp-=diff;
	}

	//Function  to calculate difference in ftp hours.
	void calc_diff_ftp(void);

	//Function to put ftpp_pdd for each day ( i ) using ftp_pd and change_ftp
	//It also changes ftp_tdd and diff_ftp accordingly.
	void put_ftp(void);

	//Function to return ftp_otd ie. FTP hrs on that day
	float get_ftp_otd(int day)
	{
		return round(ftp_pdd[day],1);
	}

	//Function to return ftp_td
	float get_ftp_td(void)
	{
		return ftp*8*nod;
	}

	//Function to return sign of the FTP difference
	int get_sign(void)
	{
		if(round(diff_ftp,4)==0)
			return 1;
		return diff_ftp/mod(diff_ftp);
	}

	//Function to return ftp_tdd
	float get_ftp_tdd(void)
	{
		return ftp_tdd;
	}

	//Function to return diff_ftp
	float get_diff_ftp(void)
	{
		return diff_ftp;
	}

	//Function to return ftp_pd
	float get_ftp_pd(void)
	{
		return ftp_pd;
	}

	//Function to return ftp
	float get_ftp(void)
	{
		return ftp;
	}

	//Function to get actual FTP entered
	float show_FTP(void)
	{
		return ftp+change_ftp;
	}

	//Function to return the activity name.
	char * get_ap_name(void)
	{
		return ap_name;
	}

	//Function to return the activity name.
	char * get_pid(void)
	{
		return pid;
	}

	//Function to return the activity name.
	char * get_wi(void)
	{
		return wi;
	}

	//Function to return the activity name.
	char * get_activity(void)
	{
		return activity;
	}

	~ilc()
	{
		delete [] ftp_pdd;
	}
};


float ilc::ftp_total=0;

void ilc::calc_diff_ftp(void)
{
	ftp_tdd=0;
	for(int i=0;i<nod;i++)
	{
		ftp_tdd+=round(ftp_pdd[i],1);
	}
	diff_ftp=round(round((change_ftp+ftp)*8*nod,4)-ftp_tdd,4);
}

void ilc::put_ftp(void)
{
	for(int i=0;i<nod;i++)
	{
		if((i+1)%5 != 0)
			ftp_pdd[i]=round(ftp_pd,1);
		else
			ftp_pdd[i]=round(round(ftp_pd,1) + ((ftp_pd - round(ftp_pd,1))*5)+round(change_ftp*8,1)*5,1);
			//To add all the lost hrd in 4 daysin calculation at the end of 5th day
	}
}

void ilc::get_data(void)
{
	cout<<"\n Application Name : ";
	cin>>ap_name;
	cout<<" Project Id : ";
	cin>>pid;
	cout<<" Work Item1 : ";
	cin>>wi;
	cout<<" Activity : ";
	cin>>activity;

	do
	{
		cout<<" FTP      : ";
		cin>>ftp;
	}while(ftp>1 || ftp <0);// To check whether FTP is not >1 or <0.
	ftp_total+=ftp;
	ftp_pd=ftp*8;
	diff_ftp=0;
}

//Function to calculate ftp hour difference for all activities.
void calc_dftp(ilc * ob)
{
	for(int i=0;i<noa;i++)
		ob[i].calc_diff_ftp();
}


void modify_ftp(ilc *ob)
{
	float tfd=0;
	//tfd : Total hours per day by default

	for(int i=0;i<noa;i++)
		tfd+=round(ob[i].get_ftp_pd(),1);

	//To change if tfd != 0
	if(tfd!=8.00)
	{
		int high=0;
		for(int i=0;i<noa;i++)
		{
			if(ob[i].get_ftp()>ob[high].get_ftp())
				high=i;
		}
		ob[high].change_ftp_pd(tfd-8);
	}
}

//Function to get number of days (max 23 but >0 )
void get_days(void)
{
	do
	{
		clrscr();
		cout<<"\n Enter No. of days : ";
		cin>>::nod;
	}while(nod>23 || nod<0);
}

//Function to get number of activities and the get there individual data until FTP == 1
ilc * get_activities(ilc * ob)
{
	do
	{
		cout<<"\n\n Enter No. of activities : ";
		cin>>::noa;

		ob = new ilc[noa];
		cout<<"\n\n";
		ilc::ftp_total=0;

		for(int i=0;i<noa;i++)
		{
			cout<<"\n\t Activity "<<i+1<<" -->";
			ob[i].get_data();
		}
		if(round(ob[i].ftp_total,4)!=1.0000)
		{
			cout<<"\n\n Wrong Enteries Please Re-Enter"<<"\nTotal FTP is  "<<ilc::ftp_total;
			getch();
			delete [] ob;
		}
	}while(round(ilc::ftp_total,4)!=1.0000);

	return ob;
}

//Function to sort ilc objects according to their correspondin diff_ftp
void sort_ilc(ilc * ob)
{
	for(int i=0;i<noa;i++)
	{
		for(int j=0;j<noa;j++)
		{
			if(mod(ob[i].get_diff_ftp())>mod(ob[j].get_diff_ftp()))
			{
				ilc tmp;
				tmp=ob[i];
				ob[i]=ob[j];
				ob[j]=tmp;
			}
		}
	}

}

//Function to put ftp hrs per day for each activity
void put_activities(ilc * ob)
{
	for(int i=0;i<noa;i++)
	{
		ob[i].put_ftp();
	}

	calc_dftp(ob);
}

//Function to reduce FTP difference by adding the difference to other activities
void reduce_sum(ilc *ob)
{
	for(int i=0;i<noa;i++)
	{
		if(round(mod(ob[i].get_diff_ftp()),2)>=0.1)
		{
			float diff=round(ob[i].get_diff_ftp(),1);

			if(diff>0)
			{
				int node=diff/(8-ob[i].get_ftp_pd())+1;

				if(node>nod)
					node=nod;

				for(int j=0;j<node;j++)
				{
					int times=0;
					float chm=0;
					if(diff>(8-ob[i].get_ftp_pd()))
					{
						chm=8-ob[i].get_ftp_pd();
					}
					else
					{
						chm=diff;
					}
					int k=i+1;
					while(round(chm,1)!=0 && times<(7*noa))
					{
						times++;
						if(k==noa)
							k=0;
						if(k==i)
							k=i+1;

						if(round(ob[k].get_diff_ftp(),2)!=0 && ob[k].get_sign()!=ob[i].get_sign())
						{
							if(ob[k].get_ftp_pd() > chm)
							{
								ob[k].change(nod-j,-chm);
								chm=0;
							}
							else
							{
								ob[k].change(nod-j,-round(ob[k].get_ftp_pd(),2));
								chm-=round(ob[k].get_ftp_pd(),1);
							}
						}
						k++;
					 };

					if(diff>(8-ob[i].get_ftp_pd()) && diff!=chm)
					{
						ob[i].change(nod-j,8-ob[i].get_ftp_pd()-chm);
						diff-=8-ob[i].get_ftp_pd()-chm;
					}
					else if(diff !=chm)
					{
						ob[i].change(nod-j,diff-chm);
						diff-=diff-chm;
					}
				}

			}

			if(diff<0)
			{
				int node=mod(diff)/(ob[i].get_ftp_pd())+1;

				if(node>nod)
					node=nod;

				for(int j=0;j<node;j++)
				{
					int times=0;
					float chm=0;
					if(mod(diff)>(ob[i].get_ftp_pd()))
					{
						chm=ob[i].get_ftp_pd();
					}
					else
					{
						chm=diff;
					}
					int k=i+1;
					while(round(chm,1)!=0 && times<101)
					{
						times++;

						if(k==noa)
							k=0;
						if(k==i)
							k=i+1;

						if(round(ob[k].get_diff_ftp(),2)!=0 && ob[k].get_sign()!=ob[i].get_sign())
						{
							if(ob[k].get_ftp_pd() > mod(chm))
							{
								ob[k].change(nod-j,-chm);
								chm=0;
							}
							else
							{
								ob[k].change(nod-j,round(ob[k].get_ftp_pd(),1));
								chm+=round(ob[k].get_ftp_pd(),1);
							}
						}
						k++;
					};

					if(mod(diff)>(ob[i].get_ftp_pd()) && diff!=chm)
					{
						ob[i].change(nod-j,-ob[i].get_ftp_pd()+chm);
						diff+=ob[i].get_ftp_pd()+chm;
					}
					else if(diff!=chm)
					{
						ob[i].change(nod-j,diff+chm);
						diff-=diff-chm;
					}
				}
			}
		}
	}
}

//Function to reduce FTP difference to less than .04 by just adding .1 to other activities by force.
void reduce_force(ilc *ob)
{
	for(int i=0;i<noa;i++)
	{
		if(round(mod(ob[i].get_diff_ftp()),2)>0.04)
		{
			float diff=round(ob[i].get_diff_ftp(),2);
			if(diff>0)
			{
				int node=(diff/(8-ob[i].get_ftp_pd()))+1;

				if(node>nod)
					node=nod;

				for(int j=0;j<node;j++)
				{
					int k=i+1;
					while(diff>0.010 && k<noa)
					{
						if(round(ob[k].get_diff_ftp(),2)!=0 && ob[k].get_sign()!=ob[i].get_sign() && round(mod(ob[k].get_diff_ftp()),2)>=0.01)
						{
							ob[k].change(nod-j,-.1);
							ob[i].change(nod-j,.1);
							diff-=.1;
						}
						k++;
					 };
				}
			}

			else
			{
				int node=mod(diff)/(ob[i].get_ftp_pd())+1;

				if(node>nod)
					node=nod;

				for(int j=0;j<node;j++)
				{
					int k=i+1;
					while(diff<0.010 && k<noa)
					{
						if(round(ob[k].get_diff_ftp(),2)!=0 && ob[k].get_sign()!=ob[i].get_sign() && round(mod(ob[k].get_diff_ftp()),2)>=0.01)
						{
							ob[k].change(nod-j,.1);
							ob[i].change(nod-j,-.1);
							diff+=.1;
						}
						k++;
					 };
				}
			}
		}
	}
}

//Function to reduce diff_ftp of an activity by distributing it other activity
//Limit for these is .1
void reduce_ftps(ilc *ob)
{
	reduce_sum(ob);
	reduce_force(ob);
	calc_dftp(ob);
}

//Following thing adds Data to file "ILC_code.csv"
void make_excel(ilc * ob)
{
	fstream file;
	file.open("ILC_code.csv",ios::out);
	if(!file)
	{
		cout<<"\nFile problem!!!";
		cout<<"\nPlease check if file is open or disk space is not full.";
		getch();
		exit(0);
	}

	file<<",,,,,,";

	for(int i=0;i<nod;i++)
	{
		file<<"DAY "<<i+1;
		file<<",";
	}

	file<<"\nApplication Name,Project ID,Work Item,Activity,FTP Allocated\n";
	cout<<"\nDone 10%";

	for(i=0;i<noa;i++)
	{
		file<<ob[i].get_ap_name()<<",";
		file<<ob[i].get_pid()<<",";
		file<<ob[i].get_wi()<<",";
		file<<ob[i].get_activity()<<",";
		file<<ob[i].show_FTP()<<",";
		for(int j=0;j<nod;j++)
		{
			file<<","<<(ob[i].get_ftp_otd(j));
		}
		file<<"\n";
	}

	cout<<"\b\b\b40%";
	file<<"\n,,,,,Total Hours";

	float *sum_hr;
	sum_hr=new float[nod];
	for(int j=0;j<nod;j++)
	{
		sum_hr[j]=round(ob[0].get_ftp_otd(j),1);
	}

	for(i=1;i<noa;i++)
	{
		for(int j=0;j<nod;j++)
		{
			sum_hr[j]+=round(ob[i].get_ftp_otd(j),1);
		}
	}

	for(j=0;j<nod;j++)
	{
		file<<","<< round(sum_hr[j],1);
	}

	delete [] sum_hr;
	cout<<"\b\b\b60%";


	file<<"\n\n\n,,,,,";
	file<<"\n,,,,,Final FTP Differences -->";
	file<<"\n\n,,,,,ACTIVITY,FTP Difference,HOUR Difference";
	float sum_fd=0;
	for(i=0;i<noa;i++)
	{
		file<<"\n,,,,,";
		file<<ob[i].get_activity()<<","<<round(ob[i].get_diff_ftp(),4)/8<<","<<round(ob[i].get_diff_ftp(),4);
		sum_fd+=(ob[i].get_diff_ftp());
	}
	file<<"\n,,,,,";
	file<<"Difference Sum"<<","<<round(sum_fd/8,6)<<","<<round(sum_fd,4);
	cout<<"\b\b\b100%";

	file.close();
}

void clear(void)
{
	for(int i=0;i<70;i++)
		cout<<"\n";
}

void about_prog(void)
{
	clear();
	cout<<"\t\t\t      ILC CALCULATOR\n\n The program helps you to calculate your daily ilc hours."
	    <<"\n You just have to follow the following steps : "
	    <<"\n\n 1. Kindly make sure you are in Windows environement."
	    <<"\n 2. Enter the required fields as they come."
	    <<"\n\ti.  Number of Days (maximum 23)"
	    <<"\n\tii. Number of Activities"
	    <<"\n\tiii.Application Name (maximum 10 characters)"
	    <<"\n\tiv. Project ID (maximum 10 characters)"
	    <<"\n\tv.  Work Item (maximum 10 characters)"
	    <<"\n\tvi. Activity Name (maximum 7 characters)"
	    <<"\n\tvii.FTP (for that activity) (maximum 1)"
	    <<"\n\n  Above 2 elements you have to eneter the number of activity times"
	    <<"\n 3. The file saved is ILC_code.csv. Please open and copy the codes."
	    <<"\n\n !!!WARNINGS!!!"
	    <<"\n 1. Don't enter any other data other than numeric for number of days, number of"
	    <<"\n activities & FTP."
	    <<"\n 2. If the total FTP for the activities is greater than ! then you have to enter for all the activities again. So PLEASE be careful.";


	cout<<"\n\n\t\t\t   PRESS ANY KEY TO CONTINUE";
	getch();
}

void main()
{
	about_prog();

	clear();
	get_days();

	ilc *ob;
	ob=get_activities(ob);

	modify_ftp(ob);
	sort_ilc(ob);
	put_activities(ob);

	cout<<"\n\nCalculating. Please wait.";
	reduce_ftps(ob);
	cout<<"\nCalculation Done.";

	cout<<"\nWriting To File. Please Wait... ";
	make_excel(ob);
	cout<<"\nFile Writing is done.";

	cout<<"\n\t\t\t   PRESS ANY KEY TO CONTINUE";
	getch();

	delete [] ob;
}

>>program is running fine from the tc
I guess that means Turbo C compiler ?

Sounds like the csv file is not where you think it is. Check to see that it is located in the same directory as the *.exe file. If not, then did your program specify the full path to the file in the open statement ? [edit]see line 535 of the code you posted[/edit]

>>program is running fine from the tc
I guess that means Turbo C compiler ?

Sounds like the csv file is not where you think it is. Check to see that it is located in the same directory as the *.exe file. If not, then did your program specify the full path to the file in the open statement ?

No.. i have not mentioned any PATH. also for some of the data enteries its working fine and creating the csv file. but for some its not. I thought there is some bufferstream problem.
but i was not able to solve the problem.
I have posted the code above.

I don't know what your code really does,
I just check the language semantics.

ilc *ob;	
ob=get_activities(ob);

check the codding of get_activities(..), it returns pointer to array of object of type ilc
but within the function get_activities (...). line number 300.

delete [] ob;

so according to my knowledge in some cases your code executes and in some it doesn't well, if it runs on Turbo C++ compiler, I suggest you must change your compiler, use VS 2005 atleast.

Is there a difference between the data that works and the data that doesn't work?

I got it to compile with VC++ 2008 Express. Please post the entries that work ok and an example of the entries that do not work.

I don't know what your code really does,
I just check the language semantics.

ilc *ob;	
ob=get_activities(ob);

check the codding of get_activities(..), it returns pointer to array of object of type ilc
but within the function get_activities (...). line number 300.

delete [] ob;

and you call delete[] ob in main () as well.

so in some cases your code executes and in some it doesn't well, if it runs on Turbo C++ compiler, I suggest you must change your compiler, use VS 2005 atleast.

I don't know what your code really does,
I just check the language semantics.

ilc *ob;	
ob=get_activities(ob);

check the codding of get_activities(..), it returns pointer to array of object of type ilc
but within the function get_activities (...). line number 300.

delete [] ob;

so according to my knowledge in some cases your code executes and in some it doesn't well, if it runs on Turbo C++ compiler, I suggest you must change your compiler, use VS 2005 atleast.

thnx a lot. but the problem is happening at the level of writing to file the last step. its calculating fine. and and that to not for all the data. so really its confusing.
and also only the xe is giving this problem not when i'm directly running frm code.

>>its calculating fine
Not with the bug Laiq found. The program is attempting to use an uninitialized variable which can cause any number of program errors.

ilc *ob = NULL;	
ob=get_activities(ob);

[edit]You're right -- after looking at get_activities() the above really isn't a problem. But you should initialize ob to NULL anyway.

ilc * get_activities(ilc * ob)
{
	do
	{
		cout<<"\n\n Enter No. of activities : ";
		cin>>::noa;

		ob = new ilc[noa];

Why is ob even a parmeter to that funciton ? You might as well just make it a local variable.

>>its calculating fine
Not with the bug Laiq found. The program is attempting to use an uninitialized variable which can cause any number of program errors.

ilc *ob = NULL;	
ob=get_activities(ob);

[edit]You're right -- after looking at get_activities() the above really isn't a problem. But you should initialize ob to NULL anyway.

thnx.. ya it might do that.,.. i just changed and again made the exe but its again throwing same problem. this is the copied image from command prompt (insde /* */) as below:


/*
Enter No. of days : 23


Enter No. of activities : 3

Activity 1 -->
Application Name : 1
Project Id : 1
Work Item1 : 1
Activity : 1
FTP : .86

Activity 2 -->
Application Name : 2
Project Id : 2
Work Item1 : 2
Activity : 2
FTP : .12

Activity 3 -->
Application Name : 3
Project Id : 3
Work Item1 : 33
Activity : 3
FTP : .02


Calculating. Please wait.
Calculation Done.
Writing To File. Please Wait...
*/


It stops here. i don't know why??

There is a definite problem in your program some place because the program crashes at the end. After I press any key to continue it crashes.


Activity 2 -->
Application Name : 2
Project Id : 2
Work Item1 : 2
Activity : 2
FTP : .12

Activity 3 -->
Application Name : 3
Project Id : 3
Work Item1 : 3
Activity : 3
FTP : .02


Calculating. Please wait.
Calculation Done.
Writing To File. Please Wait...

Done 100%
File Writing is done.

PRESS ANY KEY TO CONTINUE

and this is the output csv file

,,,,,,DAY 1,DAY 2,DAY 3,DAY 4,DAY 5,DAY 6,DAY 7,DAY 8,DAY 9,DAY 10,DAY 11,DAY 12,DAY 13,DAY 14,DAY 15,DAY 16,DAY 17,DAY 18,DAY 19,DAY 20,DAY 21,DAY 22,DAY 23,
Application Name,Project ID,Work Item,Activity,FTP Allocated
1,1,1,1,0.86,,0,0,-4.22017e+037,6.8,0,0,0,0,6.8,7.2,6.8,6.8,6.8,6.8,7.2,6.8,6.8,6.8,6.8,7.2,6.8,6.8,7
2,2,2,2,0.12,,1,1,1,1,0.8,1,1,1,1,0.8,1,1,1,1,0.8,1,1,1,1,0.8,1,1,0.9
3,3,3,3,0.02,,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.1

,,,,,Total Hours,1.2,1.2,-4.22017e+037,8,0.8,1.2,1.2,1.2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8


,,,,,
,,,,,Final FTP Differences -->

,,,,,ACTIVITY,FTP Difference,HOUR Difference
,,,,,1,0.005,0.04
,,,,,2,-0.0025,-0.02
,,,,,3,-0.0025,-0.02
,,,,,Difference Sum,0,0

There is a definite problem in your program some place because the program crashes at the end. After I press any key to continue it crashes.

No the program has to end there. So it terminates.

and this is the output csv file

,,,,,,DAY 1,DAY 2,DAY 3,DAY 4,DAY 5,DAY 6,DAY 7,DAY 8,DAY 9,DAY 10,DAY 11,DAY 12,DAY 13,DAY 14,DAY 15,DAY 16,DAY 17,DAY 18,DAY 19,DAY 20,DAY 21,DAY 22,DAY 23,
Application Name,Project ID,Work Item,Activity,FTP Allocated
1,1,1,1,0.86,,0,0,-4.22017e+037,6.8,0,0,0,0,6.8,7.2,6.8,6.8,6.8,6.8,7.2,6.8,6.8,6.8,6.8,7.2,6.8,6.8,7
2,2,2,2,0.12,,1,1,1,1,0.8,1,1,1,1,0.8,1,1,1,1,0.8,1,1,1,1,0.8,1,1,0.9
3,3,3,3,0.02,,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.1

,,,,,Total Hours,1.2,1.2,-4.22017e+037,8,0.8,1.2,1.2,1.2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8


,,,,,
,,,,,Final FTP Differences -->

,,,,,ACTIVITY,FTP Difference,HOUR Difference
,,,,,1,0.005,0.04
,,,,,2,-0.0025,-0.02
,,,,,3,-0.0025,-0.02
,,,,,Difference Sum,0,0

Ya its correct only.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.