arrays

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2007
Posts: 35
Reputation: olams is an unknown quantity at this point 
Solved Threads: 0
olams olams is offline Offline
Light Poster

arrays

 
0
  #1
Jan 24th, 2008
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.

  1. *void lfib(int a){
  2. int i;
  3. eArray x(500), y(500), ans(500);
  4. x=y=1;
  5. for(i = 1; i<=a; i++){
  6. ans = x + y;
  7. x = y;
  8. y = ans;
  9. }
p.s eArray is the name of the class
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,678
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 193
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso

Re: arrays

 
0
  #2
Jan 24th, 2008
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.
Everyone's gotta believe in something. I believe I'll have another drink.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: arrays

 
0
  #3
Jan 24th, 2008
[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]
Last edited by Duoas; Jan 24th, 2008 at 2:13 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC