跳到内容

neuroai

  • Home
  • All Courses
  • 科研研学
  • 更新日志
  • 点名系统
  • Log In
  • About
neuroai

数组应用

  1. C++程序设计
  2. 第五章 数组
  3. 数组应用

fibonacci数

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <iostream>
using namespace std;
int main(){
    int f;
    cin>>f;
    int a[f];
    a[0]=0;
    a[1]=1;
    for(int i=0;i+2<f;i++){
        a[i+2]=a[i+1]+a[i];
        cout<<a[i+2]<<endl;
        }
    }
测验
小测验-数组应用
Previous 主题
Back to 课
Next 测验

© 2026 neuroai Kadence WP 制作的 WordPress 主题

  • Home
  • All Courses
  • 科研研学
  • 更新日志
  • 点名系统
  • Log In
  • About