Term Papers on C++ from Term Papers Lab.

Below is a free excerpt of our term paper on C++

Term Papers Excerpt

Fibonacci Series Using an Array
We have now used a variety the features of C. This final example will introduce the array. The program prints out a table of Fibonacci numbers. These are defined by a series in which any element is the sum of the previous two elements. This program stores the series in an array, and after calculating it, prints the numbers out as a table.

#include

main()
{ int fib[24];
int i;

fib[0] = 0;
fib[1] = 1;

for(i = 2; i < 24; i++)
fib[i] = fib[i-1] + fib[i-2];

for (i = 0; i < 24; i++)
printf("%3d %6d\n", i, fib[i]);
}
One new construct has been introduced here.
int fib[24];
This defines an array called fib of 24 integers. In C, the array index is bounded by square brackets (this avoids confusion with a function call). Also, the first element of the array has index zero, and for this 24 element array, the last element is index 23.
Following this brief......



Join Now to view the rest of this term paper!
Members: Login to view this research paper.

Title: C++
Approximate Word Count: 251
Approximate Pages: 2 (250 words per double-spaced page)

With the Term Papers Lab Membership Pass, you get instant access to every essay on this site, including this essay on C++, for as long as you remain a member.

Other essays sites charge almost $100 for a single term paper. At Term Papers Lab, you can get instant access to over 100,000 research papers for as little as $29.95!

Credit Card

Pay by Credit Card

Bank Account

PayPal

Pay with PayPal


Search Our Database

Looking for other example research papers? Use the search box above.



Save papers so you can
find them more easily!
Get instant access to over
100,000 papers.

Join Now!