|
#include <stdio.h>
#include "utilities.h"
static unsigned int fibonacci[MAX_FIB];
/*
Initialize the array above with the first Fibonacci
numbers.
*/
void init_fib( void )
{
char i;
fibonacci[0] = 1;
fibonacci[1] = 1;
for ( i=2 ; i<MAX_FIB ; ++i)
fibonacci[i] = fibonacci[i-1] + fibonacci[i-2];
}
/*
Get the n:th Fibonacci number, or 0 if the
index is greater than MAX_FIB
*/
unsigned int get_fib( int index )
{
if ( index >= MAX_FIB )
return ( 0 );
return fibonacci[index];
}
/*
Print the given number to the standard output
*/
void put_fib( unsigned int value )
{
char buf[8], *p, ch;
p = buf;
*p++ = 0;
do
{
*p++ = '0' + value % 10;
value /= 10;
}while ( value != 0 );
*p++ = '\n';
while ( (ch = *--p) != 0 )
putchar ( ch );
}
然后编译它提示 Fatal Error[Pe005]: could not open source file "stdio.h" 都说是路径的问题 但是不会改啊 新手求教 万分感谢
|
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|