網頁

2016年9月23日 星期五

ex3 C++陣列練習

請用C++11 array撰寫存費式數列的C++練習



Java版


42 則留言:

  1. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;

    int main()
    {
    array<int, 40>x;
    x[0] = x[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    x[i] = x[i - 1] + x[i - 2];
    cout << i << "---" << x[i]<<endl;
    }
    system("Pause");
    return 0;
    }

    回覆刪除
  2. #include <iostream>
    #include <cstdlib>
    #include<array>
    using namespace std;
    int main()
    {
    array<int,40 >a;
    a[0] = a[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    a[i] = a[i - 1] + a[i - 2];
    cout << i << ">>>>>>>>>>>>>" << a[i] << endl;
    }system("Pause");
    return 0;
    }

    回覆刪除
  3. #include
    #include
    #include
    using namespace std;

    int main()
    {
    arrayx;
    x[0] = x[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    x[i] = x[i - 1] + x[i - 2];
    cout << i << "---" << x[i] << endl;
    }
    system("Pause");
    return 0;
    }

    回覆刪除
  4. #include<iostream>
    #include<cstdlib>
    #include<array>
    using namespace std;
    int main()
    {
    array<int, 40>x;
    x[0] = x[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    x[i] = x[i - 1] + x[i - 2];
    cout << i << "---" << x[i] << endl;
    }
    system("pause");
    return 0;
    }

    回覆刪除
  5. #include
    #include
    #include
    using namespace std;
    int main()
    {
    arraya;
    a[0] = a[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    a[i] = a[i - 1] + a[i - 2];
    cout << i << ">>>>>>>>>>>>>" << a[i] << endl;
    }system("Pause");
    return 0;





    }

    回覆刪除
  6. #include
    #include
    #include
    using namespace std;
    int main()
    {
    arraya;
    a[0] = a[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    a[i] = a[i - 1] + a[i - 2];
    cout << i << ">>>>>>>>>>>>>" << a[i] << endl;
    }system("Pause");
    return 0;





    }

    回覆刪除
  7. B10233082 唐偉強2016年9月23日 下午4:22

    #include
    #include
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  8. #include<iostream>
    #include<cstdlib>
    #include<array>
    using namespace std;
    int main(){
    int x[40];
    x[0] = x[1] = 1;
    for (int i = 2; i <40; i++){
    x[i] = x[i - 1] + x[i - 2];
    cout << i << "-->" << x[i]<<"\n";
    }
    system("pause");
    return 0;
    }

    回覆刪除
  9. B10233074許逸憲2016年9月23日 下午4:24

    #include
    #include
    #include
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  10. B10233073 楊博宇2016年9月23日 下午4:24

    #include
    #include
    #include
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  11. B10233109 宋昱璋2016年9月23日 下午4:25

    #include
    #include
    #include
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  12. B10233087 黃少洋2016年9月23日 下午4:26

    #include
    #include
    #include
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  13. B10233102 羅時宇2016年9月23日 下午4:26

    #include
    #include
    #include
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  14. #include
    #include
    #include
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  15. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array<int,40> y;
    y[0] = y[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    y[i] = y[i - 1] + y[i - 2];
    cout << i << "-->" << y[i] << endl;
    }
    system("Pause");
    return 0;
    }

    回覆刪除
  16. #include <iostream>
    #include <cstdlib>
    using namespace std;
    int main(void) {
    int x[40];
    x[0] = x[1] = 1;
    for (int i = 2; i <40; i++){
    x[i] = x[i - 1] + x[i -2];
    cout << i << "-->" << x[i] << endl;
    }
    system("pause");
    return 0;
    }

    回覆刪除
  17. #include <iostream>
    #include <cstdlib>
    using namespace std;
    int main(void) {
    int x[40];
    x[0] = x[1] = 1;
    for (int i = 2; i <40; i++){
    x[i] = x[i - 1] + x[i -2];
    cout << i << "-->" << x[i] << endl;
    }
    system("pause");
    return 0;
    }

    回覆刪除
  18. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array<int, 20>x;
    x[0] = x[1]=1;
    for (int i = 2 ;i <20; i++){
    x[i] = x[i-1] + x[i-2];
    cout << i << "----->" << x[i] << "\n";
    }
    system("pause");
    return 0;
    }

    回覆刪除
  19. B10233082 唐偉強2016年9月23日 下午4:42

    #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  20. #include <iosteream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array<int, 40 >a;
    a[0] = a[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    a[i] = a[i - 1] + a[i - 2];
    cout << i << ">>>>>>>>>>>>>" << a[i] << endl;
    }system("Pause");
    return 0;

    回覆刪除
  21. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;

    int main(){
    array<_int64, 40>a;
    a[0] = a[1] = 1;
    for (int b = 2; b <40; b++){
    a[b] = a[b-1] + a[b-2];
    cout << b << "---->" << a[b] << endl;
    }
    system("pause");
    return 0;
    }

    回覆刪除
  22. B10233127李昆和2016年9月23日 下午4:42

    #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0]=0;
    b[1]=1;
    for(a=2;a<=45;a++)
    {
    b[a]=b[a-1]+b[a-2];
    cout<<b[a]<<endl;
    }
    system("pause");
    }

    回覆刪除
  23. B10233074 許逸憲2016年9月23日 下午4:42

    #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  24. B10233073 楊博宇2016年9月23日 下午4:43

    #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  25. B10233109 宋昱璋2016年9月23日 下午4:43

    #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  26. B10233087 黃少洋2016年9月23日 下午4:43

    #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  27. B10233102 羅時宇2016年9月23日 下午4:43

    #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  28. B10233096 金綱儒2016年9月23日 下午4:44

    #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  29. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array < long long, 40>x;
    x[0] = x[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    x[i] = x[i - 1] + x[i - 2];
    cout << i << "-->" << x[i] << "\n";
    }
    system("Pause");
    return 0;
    }

    回覆刪除
  30. #include <iosteream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array< long long, 100> x;
    x[0] = x[1] = 1;
    for (int i = 2; i < 100; i++)
    {
    x[i] = x[i - i] + x[i - 2];
    cout << i << "--->" << x[i] << "\n";
    }
    system("pause");
    return 0;
    }

    回覆刪除
  31. B10233108 林宣瑋2016年9月23日 下午5:06

    #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array< _int64, 100>x;
    x[0] = x[1] = 1;
    for (int i = 2; i < 100; i++)
    {
    x[i] = x[i - 1] + x[i - 2];
    cout << i << "--->" << x[i] << "\n";
    }
    system("pause");
    return 0;
    }

    回覆刪除
  32. #include <iosteream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array<int, 40 >a;
    a[0] = a[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    a[i] = a[i - 1] + a[i - 2];
    cout << i << ">>>>>>>>>>>>>" << a[i] << endl;
    }system("Pause");
    return 0;

    回覆刪除
  33. #include <iosteream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array< long long, 100> x;
    x[0] = x[1] = 1;
    for (int i = 2; i < 100; i++)
    {
    x[i] = x[i - i] + x[i - 2];
    cout << i << "--->" << x[i] << "\n";
    }
    system("pause");
    return 0;
    }

    回覆刪除
  34. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main(){
    array<int,40>x;
    x[0]=x[1]=1;
    for(int i=2;i<40;i++){
    x[i]=x[i-1]+x[i-2];
    cout<<i<<"-->"<<x[i]<<"\n";
    }
    }

    回覆刪除
  35. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0]=0;
    b[1]=1;
    for(a=2;a<=45;a++)
    {
    b[a]=b[a-1]+b[a-2];
    cout<<b[a]<<endl;
    }
    system("pause");
    }

    回覆刪除
  36. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  37. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  38. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array<_int64, 100>x;
    x[0] = x[1] = 1;
    for (int i = 2; i < 100; i++)
    {
    x[i] = x[i - 1] + x[i - 2];
    cout << i << "-->" << x[i] << "\n";

    }


    system("pause");
    return 0;
    }

    回覆刪除
  39. #include <iostream>
    #include <cstdlib>
    #include <array>
    using namespace std;
    int main()
    {
    array <_int64, 100>x;
    x[0] = x[1] = 1;
    for (int i = 2; i < 100; i++)
    {
    x[i] = x[i - 1] + x[i - 2];
    cout << i << "--->" << x[i] << "\n";
    }

    system("Pause");
    return 0;
    }

    回覆刪除
  40. #include
    #include
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  41. #include
    #include
    using namespace std;
    int main()
    {
    int a;
    int b[45];
    b[0] = 0;
    b[1] = 1;

    for (a = 2; a <= 45; a++)
    {
    b[a] = b[a - 1] + b[a - 2];
    cout << b[a] << endl;
    }
    system("pause");

    }

    回覆刪除
  42. B10233082 唐偉強2016年12月16日 下午5:19

    #include
    #include
    #include
    using namespace std;

    int main()
    {
    arrayx;
    x[0] = x[1] = 1;
    for (int i = 2; i < 40; i++)
    {
    x[i] = x[i - 1] + x[i - 2];
    cout << i << "---" << x[i]<<endl;
    }
    system("Pause");
    return 0;
    }

    回覆刪除

HTML 編輯器