GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Dec-2005, 16:12
Blstretch Blstretch is offline
New Member
 
Join Date: Oct 2005
Posts: 21
Blstretch is on a distinguished road

Trouble with files and array linking to files.


Hi guys, im back again...

just wondering if my code looks good so far, im having a bit of trouble understanding the way files work with arrays, but other than that im ok.

If someone could look at the start of my program and tell me how it looks, that would be awesome.

you guys helped me so much last time i needed it with functions and i ended up with a clean 100% on my assignment.

here is the code so far. (remember is it in plain C)

CPP / C++ / C Code:
 
#include <stdio.h>

double payroll(double payrate[10]);
double gross(double hours, double payrate);
double longterm(double grosspay);


main()
{
	char lname[14], fname[14];

	int emp, gn, c=5;
	double hours, gp, ei, ltb, cpp, ft, ded, net, totgp=0, totnet=0, p[10];

	FILE *ptr1;
	FILE *ptr2;

	ptr1 = fopen("employees.dat", "r");
	ptr2 = fopen("payroll.dat", "w");

	fprintf(ptr2, "Emp# Last Name    First Name     Gross Pay        LTB         EI        CPP         FT Deductions    Net Pay\n");


	while(c = fscanf(ptr1, "%d:%[^:]:%[^:]:%d:%lf:%[^\n]\n", &emp, lname, fname, &gn, &hours) )
	{

	    gp = gross(hours, p[gn-1]);

		ltb = longterm(gp);

		ei = employ(gp);

		cpp = pension(gp);

		ft = tax(gp);

		ded = ltb + ei + cpp + ft;

		net = gp - ded;

		fprintf(ptr2, "%-5.04d %-13s %-13s %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf \n", emp, lname, fname, gp, ltb, ei, cpp, ft, ded, net);

	}

	totgp = totgp + gp;

	totnet = totnet + net;

	printf("# of Employess: %d Total Net Pay: %.2lf Total Gross Pay: %.2lf\n", emp, totnet, totgp);

}



double payroll(double payrate[10])
{
	int c;

	FILE *ptr;
	ptr = fopen("payrates.dat", "r");

	if (ptr == NULL)
		printf("couldn't open file\n");

	else {
		for(c = 0; c < 10; c++) {
			fscanf(ptr, "%lf\n", payrate[c]);
		} fclose(ptr);
	}
}

double gross(double hours, double payrate)
{
	if (hours <= 44)
		grosspay = hours * payrate;
		return grosspay;
	
	else 
		grosspay = (hours * payrate) + ((hours - 44) * (payrate * 1.5))
		return grosspay;
}


		
double longterm(double grosspay)
{
	int p;
	
	p = grosspay / 100;
	
	if (p <= 50)
		ltb = p * 2;
		return ltb;
	else 
		ltb = 100;
		return ltb;
		
}

my only problem is, when i take out the variables that dont have functions, and run it, the file that it writes to goes on infinitely...
  #2  
Old 01-Dec-2005, 17:01
Blstretch Blstretch is offline
New Member
 
Join Date: Oct 2005
Posts: 21
Blstretch is on a distinguished road

Re: Trouble with files and array linking to files.


umm, also i need a bit of help im calculating some numbers inside my functions.

it needs to be done like for example this is one i have started but cannot finish.
Federal tax (FT) is deducted from gross pay. FT is calculated based on what a person would earn for a full year, assuming that the employee will make the current week's gross pay every week for a full 52 weeks. The rates are:

16% on the first $20,000 earned annually
23% on the next $20,000 earned annually
29% on the remainder earned annually

my function looks like this so far

CPP / C++ / C Code:
double tax(double grosspay)
{
	grosspay = grosspay * 52
	
	if (grosspay <= 20000)
		ft = (grosspay * 0.16) / 52
	else if (grosspay > 20000 && grosspay <= 40000)
		ft = (

  #3  
Old 01-Dec-2005, 17:37
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: Trouble with files and array linking to files.


Hi Blstretch,

Quote:
Originally Posted by Blstretch
Hi guys, im back again...
Welcome Back.

There are quite a few errors in your program:
1. Consider this function:
CPP / C++ / C Code:
double gross(double hours, double payrate)
{
    if (hours <= 44)
        grosspay = hours * payrate;
        return grosspay;
    
    else 
        grosspay = (hours * payrate) + ((hours - 44) * (payrate * 1.5))
        return grosspay;
}

The error which comes up is : grosspay: Undeclared identifier
So, the problem is grosspay is undeclared here.

You have to initialize a variable grosspay inside the function, because the scope of the earlier grosspay is within the main function only.

The, about the if else statements:
Use braces. For example, :
CPP / C++ / C Code:
    if (hours <= 44)
        grosspay = hours * payrate;
        return grosspay;
Should be written like this:
CPP / C++ / C Code:
    if (hours <= 44)
    {
        grosspay = hours * payrate;
        return grosspay;
    }

So, the updated function will be like this:
CPP / C++ / C Code:
double gross(double hours, double payrate)
{
    int grosspay;
    
    if (hours <= 44)
    {
        grosspay = hours * payrate;
        return grosspay;
    }
    else 
    {
        grosspay = (hours * payrate) + ((hours - 44) * (payrate * 1.5))   /* you also missed a semicolon here. LOOK OUT!!! */
        return grosspay;
    }
}

Similarly, modify the other function also.

And what does your employees and payrates .dat files contain?
Without knowing that, it will be difficult to guess what you are doing.

Regards,
Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #4  
Old 01-Dec-2005, 17:45
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 929
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: Trouble with files and array linking to files.


Quote:
Originally Posted by Blstretch
16% on the first $20,000 earned annually
23% on the next $20,000 earned annually
29% on the remainder earned annually

my function looks like this so far

CPP / C++ / C Code:
double tax(double grosspay)
{
	grosspay = grosspay * 52
	
	if (grosspay <= 20000)
		ft = (grosspay * 0.16) / 52
	else if (grosspay > 20000 && grosspay <= 40000)
		ft = (

Good progress. But here is a logic:
1. First multiply 52 to grosspay. (You already did!)
2. Check if grosspay is greater than 20000. If it is, then computer ft for 16%.Then subtract 20000 from grosspay, because you have computed for first 20000. (Can you understand this?)
3. Then, check using another if statement, whether grosspay is still greater than 20000. If it is, then add to ft, grosspay * 0.23 /52.
Then subtract 20000 from grosspay again.
4. Then, add another 29% of remaining grosspay to ft.


Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #5  
Old 01-Dec-2005, 18:44
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,281
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Trouble with files and array linking to files.


Quote:
Originally Posted by Blstretch
Hi guys, im back again...
Welcome back...

Quote:
Originally Posted by Blstretch
just wondering if my code looks good so far, im having a bit of trouble understanding the way files work with arrays, but other than that im ok.

If someone could look at the start of my program and tell me how it looks, that would be awesome.
What are we looking for? Style? Errors? Improvements? What?

Quote:
Originally Posted by Blstretch
you guys helped me so much last time i needed it with functions and i ended up with a clean 100% on my assignment.
Excellent!!!

Quote:
Originally Posted by Blstretch
here is the code so far. (remember is it in plain C)

CPP / C++ / C Code:
 
#include <stdio.h>

double payroll(double payrate[10]);
double gross(double hours, double payrate);
double longterm(double grosspay);


main()
{
	char lname[14], fname[14];

	int emp, gn, c=5;
	double hours, gp, ei, ltb, cpp, ft, ded, net, totgp=0, totnet=0, p[10];

	FILE *ptr1;
	FILE *ptr2;

	ptr1 = fopen("employees.dat", "r");
	ptr2 = fopen("payroll.dat", "w");

	fprintf(ptr2, "Emp# Last Name    First Name     Gross Pay        LTB         EI        CPP         FT Deductions    Net Pay\n");


	while(c = fscanf(ptr1, "%d:%[^:]:%[^:]:%d:%lf:%[^\n]\n", &emp, lname, fname, &gn, &hours) )
	{

	    gp = gross(hours, p[gn-1]);

		ltb = longterm(gp);

		ei = employ(gp);

		cpp = pension(gp);

		ft = tax(gp);

		ded = ltb + ei + cpp + ft;

		net = gp - ded;

		fprintf(ptr2, "%-5.04d %-13s %-13s %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf \n", emp, lname, fname, gp, ltb, ei, cpp, ft, ded, net);

	}

	totgp = totgp + gp;

	totnet = totnet + net;

	printf("# of Employess: %d Total Net Pay: %.2lf Total Gross Pay: %.2lf\n", emp, totnet, totgp);

}



double payroll(double payrate[10])
{
	int c;

	FILE *ptr;
	ptr = fopen("payrates.dat", "r");

	if (ptr == NULL)
		printf("couldn't open file\n");

	else {
		for(c = 0; c < 10; c++) {
			fscanf(ptr, "%lf\n", payrate[c]);
		} fclose(ptr);
	}
}

double gross(double hours, double payrate)
{
	if (hours <= 44)
		grosspay = hours * payrate;
		return grosspay;
	
	else 
		grosspay = (hours * payrate) + ((hours - 44) * (payrate * 1.5))
		return grosspay;
}


		
double longterm(double grosspay)
{
	int p;
	
	p = grosspay / 100;
	
	if (p <= 50)
		ltb = p * 2;
		return ltb;
	else 
		ltb = 100;
		return ltb;
		
}
Your scanf() function is horrid! That's one reason why I hate it so.
I have no idea what I'm looking at nor for with no explanation of what the program is supposed to do, what it does wrong, where it's going wrong. It really needs comments.

Quote:
Originally Posted by Blstretch
my only problem is, when i take out the variables that dont have functions, and run it, the file that it writes to goes on infinitely...
This makes no sense. Details....

Quote:
Originally Posted by Blstretch
umm, also i need a bit of help im calculating some numbers inside my functions.

it needs to be done like for example this is one i have started but cannot finish.
Federal tax (FT) is deducted from gross pay. FT is calculated based on what a person would earn for a full year, assuming that the employee will make the current week's gross pay every week for a full 52 weeks. The rates are:

16% on the first $20,000 earned annually
23% on the next $20,000 earned annually
29% on the remainder earned annually

my function looks like this so far

CPP / C++ / C Code:
double tax(double grosspay)
{
	grosspay = grosspay * 52
	
	if (grosspay <= 20000)
		ft = (grosspay * 0.16) / 52
	else if (grosspay > 20000 && grosspay <= 40000)
		ft = (

Nope, not gonna work.

Think of it this way:
Code:
tax = 0 if gp > 40K then // calculate then remove the excess above 40k tax = (gp - 40K) * 29% gp = 40000 if gp > 20K then // calculate then remove the excess above 20k tax = (gp - 20K) * 29% gp = 20000 tax += gp * 16%
Something like that. Details are yours...
__________________

Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough.
-- Pearl Williams
  #6  
Old 01-Dec-2005, 20:09
Blstretch Blstretch is offline
New Member
 
Join Date: Oct 2005
Posts: 21
Blstretch is on a distinguished road

Re: Trouble with files and array linking to files.


hehe first thanks alot...
second, sorry for the mess, i have been jumping from one language to another lately, my mind is a little jumbled. stupid html...

ok, my files contain; payrates.dat 10 numbers, doubles, with each number on a new line. they ascend in wage as the go down the file.

employees.dat contains 5 pieces of information, which looks like this:
0001:white:barry:5:34.5
first thing is employee number, second is last name, then first name, then payrate number(from file earlier), and finally the number of hours worked.

and another thing is that i fixed a whole bunch of the errors myself while i as waiting for a reply...heh.

soo.

for now i would like to focus on the first function, and main.

CPP / C++ / C Code:
#include <stdio.h>

double payroll(double payrate[10]);
double gross(double hours, double payrate);
double longterm(double grosspay);
double employ(double grosspay);
double pension(double grosspay);
double tax(double grosspay);


main()
{
	char lname[14], fname[14];

	int emp, gn, c=5;
	double hours, gp, ei, ltb, cpp, ft, ded, net, totgp=0, totnet=0, p[10];

	
	FILE *ptr1;
	FILE *ptr2;
	
	ptr1 = fopen("employees.dat", "r");
	ptr2 = fopen("payroll.dat", "w");

	fprintf(ptr2, "Emp# Last Name    First Name     Gross Pay        LTB         EI        CPP         FT Deductions    Net Pay\n");
	

	while(c = fscanf(ptr1, "%d:%[^:]:%[^:]:%d:%lf:%[^\n]\n", &emp, lname, fname, &gn, &hours) )
	{

	    gp = gross(hours, p[gn-1]);

		ltb = longterm(gp);

		ei = employ(gp);

		cpp = pension(gp);

		ft = tax(gp);

		ded = ltb + ei + cpp + ft;

		net = gp - ded;

		fprintf(ptr2, "%-5.04d %-13s %-13s %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf \n", emp, lname, fname, gp, ltb, ei, cpp, ft, ded, net);

	} fclose(ptr2);
	

	totgp = totgp + gp;

	totnet = totnet + net;

	printf("# of Employess: %d Total Net Pay: %.2lf Total Gross Pay: %.2lf\n", emp, totnet, totgp);

}



double payroll(double payrate[10])
{
	int c;

	FILE *ptr0;
	
	ptr0 = fopen("payrates.dat", "r");

	if (ptr0 == NULL)
		printf("couldn't open file\n");

	else {
		for(c = 0; c < 10; c++) {
			fscanf(ptr0, "%lf\n", payrate[c]);
		} fclose(ptr0);
	}
}

um, also why is my scanf so bad?

and the program is supposed to read the payrates.dat file, read the employees.dat file, calculate gross pay, net pay and tax and deductions, and write them into a thrid file, called payroll.dat. this must be done strictly in the program, and thats about it. so basicly i need to scan the payrates into an array, then scan the employee information, one employee at a time, calculate the nessary stuff for that employee, and write that info to the file.



now, i noticed when i was looking through my code, to debug, that my function payroll doesnt get called in main, i have no idea how to call it, if it needs to be called or what.

secondly, my file payroll.dat that i write the info to, seems to never end. the formatting is perfect, and the info gets written, aside from the zeros where other numbers should be, i dont know how to stop it from writing, and what i need to do to get the calculations to work..

oh, for the record, this is what the program looks like now that i debugged a little.

CPP / C++ / C Code:






#include <stdio.h>

double payroll(double payrate[10]);
double gross(double hours, double payrate);
double longterm(double grosspay);
double employ(double grosspay);
double pension(double grosspay);
double tax(double grosspay);


main()
{
	char lname[14], fname[14];

	int emp, gn, c=5;
	double hours, gp, ei, ltb, cpp, ft, ded, net, totgp=0, totnet=0, p[10];

	
	FILE *ptr1;
	FILE *ptr2;
	
	ptr1 = fopen("employees.dat", "r");
	ptr2 = fopen("payroll.dat", "w");

	fprintf(ptr2, "Emp# Last Name    First Name     Gross Pay        LTB         EI        CPP         FT Deductions    Net Pay\n");
	

	while(c = fscanf(ptr1, "%d:%[^:]:%[^:]:%d:%lf:%[^\n]\n", &emp, lname, fname, &gn, &hours) )
	{

	    gp = gross(hours, p[gn-1]);

		ltb = longterm(gp);

		ei = employ(gp);

		cpp = pension(gp);

		ft = tax(gp);

		ded = ltb + ei + cpp + ft;

		net = gp - ded;

		fprintf(ptr2, "%-5.04d %-13s %-13s %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf %11.2lf \n", emp, lname, fname, gp, ltb, ei, cpp, ft, ded, net);

	} fclose(ptr2);
	

	totgp = totgp + gp;

	totnet = totnet + net;

	printf("# of Employess: %d Total Net Pay: %.2lf Total Gross Pay: %.2lf\n", emp, totnet, totgp);

}



double payroll(double payrate[10])
{
	int c;

	FILE *ptr0;
	
	ptr0 = fopen("payrates.dat", "r");

	if (ptr0 == NULL)
		printf("couldn't open file\n");

	else {
		for(c = 0; c < 10; c++) {
			fscanf(ptr0, "%lf\n", payrate[c]);
		} fclose(ptr0);
	}
}



double gross(double hours, double payrate)
{
	double grosspay;
	
	if (hours <= 44){
		grosspay = hours * payrate;
		return grosspay;
	}
	else {
		grosspay = (hours * payrate) + ((hours - 44) * (payrate * 1.5));
		return grosspay;
	}
}


		
double longterm(double grosspay)
{
	double ltb;
	int p;
	
	p = grosspay / 100;
	
	if (p <= 50){
		ltb = p * 2;
		return ltb;
	}
	else { 
		ltb = 100;
		return ltb;
	}
}



double employ(double grosspay)
{
	double ei;
	double e = 11.8;
	
	ei = grosspay * 0.014;
	
	if (ei > e)
		ei = e;
		
	return ei;
	
}



double pension(double grosspay)
{
	double cpp;
	double pen = 700;
	
	if (grosspay < pen)
		cpp = grosspay * 0.016;
	else 
		cpp = pen * 0.016;
		
	return cpp;
	
}




double tax(double grosspay)
{
	double ft;
	grosspay = grosspay * 52;
	
	if (grosspay > 20000){
		ft = (grosspay * 0.16 - 20000) ;
	}
	if (grosspay > 20000 ){
		ft = (grosspay * 0.23 - 20000);
	}
	if (grosspay < 0){
		ft = (grosspay * 0.29);
	}
	
	ft = grosspay / 52;
	return ft;
	 
}
  #7  
Old 01-Dec-2005, 21:49
Blstretch Blstretch is offline
New Member
 
Join Date: Oct 2005
Posts: 21
Blstretch is on a distinguished road

Re: Trouble with files and array linking to files.


um, when i try to run that program above....this is the error i get...i have no idea what it means

Phobos: /students/blstretc/test3-2>$ cc testy.c
NFS write error on host castor_nw1_svc: 88.
File: userid=5246, groupid=111
ld: 0711-711 ERROR: Input file testy.o is empty.
The file is being ignored.
  #8  
Old 01-Dec-2005, 22:10
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,281
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Trouble with files and array linking to files.


Quote:
Originally Posted by Blstretch
hehe first thanks alot...
second, sorry for the mess, i have been jumping from one language to another lately, my mind is a little jumbled. stupid html...
Saying HTML is a language is like saying Chicken McNuggets is food

Quote:
Originally Posted by Blstretch
ok, my files contain; payrates.dat 10 numbers, doubles, with each number on a new line. they ascend in wage as the go down the file.

employees.dat contains 5 pieces of information, which looks like this:
0001:white:barry:5:34.5
first thing is employee number, second is last name, then first name, then payrate number(from file earlier), and finally the number of hours worked.

and another thing is that i fixed a whole bunch of the errors myself while i as waiting for a reply...heh.
Good. You were supposed to.

Quote:
Originally Posted by Blstretch
for now i would like to focus on the first function, and main.

[code removed]

um, also why is my scanf so bad?
Read These:
scanf
scanf / character
scanf / string
scanf / number
scanf / epilog

You are using fscanf() which is a little different. I may have read the code wrong initially, but that format string... Sheesh! But because the data is coming from a file, you have more control over the input and fewer problems should arise. Not guaranteed, but you don't have a 'user' on a keyboard trying to break your program.

Quote:
Originally Posted by Blstretch
and the program is supposed to read the payrates.dat file, read the employees.dat file, calculate gross pay, net pay and tax and deductions, and write them into a thrid file, called payroll.dat. this must be done strictly in the program, and thats about it. so basicly i need to scan the payrates into an array, then scan the employee information, one employee at a time, calculate the nessary stuff for that employee, and write that info to the file.
So does that part of the program work correctly? I'll assume it does...

Quote:
Originally Posted by Blstretch
now, i noticed when i was looking through my code, to debug, that my function payroll doesnt get called in main, i have no idea how to call it, if it needs to be called or what.
Really?
1: "i have no idea how to call it" -- why? Didn't you call other functions? What's so different about the payroll function that causes such a conundrum?
2: "if it needs to be called" -- does it do something useful? Is it important to the program to arrive at a correct answer/output?

Sorry, but these questions don't make sense to me! Let's assume you do have to call it.
1) What information (data) is required for the function to work properly?
2) When in the program is that data guaranteed to be ready for the function?
That's where you call it.

Quote:
Originally Posted by Blstretch
secondly, my file payroll.dat that i write the info to, seems to never end. the formatting is perfect, and the info gets written, aside from the zeros where other numbers should be, i dont know how to stop it from writing, and what i need to do to get the calculations to work..

oh, for the record, this is what the program looks like now that i debugged a little.
Then why didn't you remove it from above

CPP / C++ / C Code:
while(c = fscanf(ptr1, "%d:%[^:]:%[^:]:%d:%lf:%[^\n]\n", &emp, lname, fname, &gn, &hours) )
Your exit condition for the while is when the return from fscanf() is 0 (the variable c) is it not? So when is c = 0? As Dave always says "make the program tell you." Output c to the screen as the first thing in the loop to see what value it is.
__________________

Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough.
-- Pearl Williams
  #9  
Old 01-Dec-2005, 22:31
Blstretch Blstretch is offline
New Member
 
Join Date: Oct 2005
Posts: 21
Blstretch is on a distinguished road

Re: Trouble with files and array linking to files.


the problem is that i dont know how to call a function to put data into an array....
the funtion payroll above takes the data from the file, and scans it into an array.

the array is supposed to be used later on to calculate grosspay, which is a different function.

i just dont understand how to call the funtion from main, to set numbers into an array.
  #10  
Old 01-Dec-2005, 22:50
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,281
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Trouble with files and array linking to files.


Quote:
Originally Posted by Blstretch
the problem is that i dont know how to call a function to put data into an array....
the funtion payroll above takes the data from the file, and scans it into an array.

the array is supposed to be used later on to calculate grosspay, which is a different function.

i just dont understand how to call the funtion from main, to set numbers into an array.
OK. Consider this program:
CPP / C++ / C Code:
int main()
{
    int aval[6] = {1,3,5,7,9,11};  // define an array
    
    output_array(aval);    // display the original data
    change_array(aval);    // modify the contents
    output_array(aval);    // display the new data

    return 0;
}

void output_array(int ary[])    // the array is defined as it's used
{                               // It is actually passed in as a pointer
    int i;
    for (i=0; i<6; i++)
        printf("%d) %2d \n", i, ary[i]);
    printf("\n");
    return;
}

void change_array(int array[])    // the array is defined as it's used
{                                 // It is actually passed in as a pointer
    int i;
    for (i=0; i<6; i++)
        array[i] = i*3;    // Loading a value changes the array 
                           //    even in main()
    return;
}
__________________

Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough.
-- Pearl Williams
 
 

Recent GIDBlogStupid Management Policies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
template comiling problems - need expert debugger! crq C++ Forum 1 01-Feb-2005 22:26
Extra null element in an array samtediou MySQL / PHP Forum 2 11-Dec-2003 12:52

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:45.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.