fork download
  1. #include<iostream>
  2.  
  3. #include<iomanip>
  4.  
  5.  
  6.  
  7. using namespace std;
  8.  
  9.  
  10.  
  11. int fab(int,int);
  12.  
  13.  
  14.  
  15. int main(){
  16.  
  17.  
  18.  
  19. int N,;
  20.  
  21. cout<<"請輸入你要輸入的整數個數:";
  22.  
  23. cin>>N;
  24.  
  25.  
  26.  
  27.  
  28.  
  29. int x[N][N];
  30.  
  31.  
  32.  
  33. for(int i=0;i<N;i++){
  34.  
  35. cout<<"請輸入整數:"<<endl;
  36.  
  37. cin>>x[0][i];
  38.  
  39. }
  40.  
  41.  
  42.  
  43. for(int i=1,k=N-1;i<N;i++,k--){
  44.  
  45. for(int j=0;j<k;j++){
  46.  
  47.  
  48.  
  49. x[i][j]=fab(x[i-1][j],x[i-1][j+1]);
  50.  
  51.  
  52.  
  53. }
  54.  
  55. }
  56.  
  57.  
  58.  
  59. for(int i=0,k=N;i<N;i++,k--){
  60.  
  61. for(int j=0;j<k;j++){
  62.  
  63.  
  64.  
  65. cout<<x[i][j]<<" ";
  66.  
  67.  
  68.  
  69.  
  70.  
  71. }
  72.  
  73. cout<<endl;
  74.  
  75. }
  76.  
  77.  
  78.  
  79. cout<<endl;
  80.  
  81.  
  82.  
  83. for(int i=N-1,k=1;i>=0;i--,k++){
  84.  
  85. for(int j=0;j<k;j++){
  86.  
  87.  
  88.  
  89. cout<<setw(2)<<x[i][j]<<" ";
  90.  
  91.  
  92.  
  93. }
  94.  
  95. cout<<endl;
  96.  
  97. }
  98.  
  99.  
  100.  
  101. system("pause");
  102.  
  103. return 0;
  104.  
  105.  
  106.  
  107. }
  108.  
  109.  
  110.  
  111.  
  112.  
  113. int fab(int a,in
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:19:11: error: expected unqualified-id before ‘;’ token
prog.cpp:101:19: error: ‘system’ was not declared in this scope
prog.cpp: At global scope:
prog.cpp:113:15: error: ‘in’ has not been declared
prog.cpp:113:15: error: expected ‘,’ or ‘...’ at end of input
prog.cpp:113:15: error: expected ‘)’ at end of input
prog.cpp:113:15: error: expected initializer at end of input
stdout
Standard output is empty