Hi,
I am writing a program about getting the nth fibonacci number using a class that i have created. I am having problems with it.
Any help is greatly appreciated.

*void lfib(int a){
	int i;
	eArray x(500), y(500), ans(500);
	x=y=1;
	for(i = 1; i<=a; i++){
		ans = x + y;
		x = y;
		y = ans;
	}

p.s eArray is the name of the class

Recommended Answers

All 2 Replies

Not knowing anything about your eArray class, it's hard to give you any help. More info would improve the chances of your getting some advice.

[EDIT]

That said, I think you are mixing integers and arrays.

x and y should each be an integer, not an array.

However, like vmanes said, knowing nothing about your eArray class I could be entirely wrong...

[/EDIT]

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.