【VC开源代码栏目提醒】:网学会员为广大网友收集整理了,Fibonacci.cpp,希望对大家有所帮助!
// Fibonacci.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
void Fib(int *pArray,int len)
{
pArray[0] = 1;
pArray[1] = 1;
for(int i=2; i<len; i++)
{
pArray[i]= pArray[i-2]+pArray[i-1];
}
}
int main(int argc, char* argv[])
{
int iArray[30]= {1,1};
Fib(iArray,30);
for(int i=0; i<30; i++)
{
if (i % 6 == 0 && i !=0 )
printf("\n");
printf("%8d",iArray[i]);
}
return 0;
}
上一篇:
frm_Ping.pas
下一篇:
不放弃终有希望