fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void fillMatrix(int *A)
  5. {
  6. cout<<A[0][0][0];
  7. }
  8.  
  9. void echoElement(int i, int j, int k, bool fill = false) {
  10. cout<<"Element ["<<i<<"]["<<j<<"]["<<k<<"]";
  11. if (fill)
  12. cout<<":";
  13. }
  14.  
  15. int A[10][10][10], B[10][10][10], C[10][10][10];
  16.  
  17. bool ideone = true;
  18.  
  19. int main() {
  20.  
  21. int n;
  22. cin>>n;
  23.  
  24. cout<<"Enter first matrix:"<<endl;
  25. for(int i=0;i<n;i++) {
  26. for(int j=0;j<n;j++) {
  27. for(int k=0;k<n;k++) {
  28. echoElement(i, j, k, true);
  29. cin>>A[i][j][k];
  30.  
  31. if (ideone)
  32. cout<<" "<<A[i][j][k]<<endl;
  33. }
  34. }
  35. }
  36.  
  37. fillMatrix(A);
  38.  
  39. return 0;
  40. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
2
compilation info
prog.cpp: In function ‘void fillMatrix(int*)’:
prog.cpp:6:14: error: invalid types ‘int[int]’ for array subscript
  cout<<A[0][0][0];
              ^
prog.cpp: In function ‘int main()’:
prog.cpp:37:13: error: cannot convert ‘int (*)[10][10]’ to ‘int*’
  fillMatrix(A);
             ^
prog.cpp:4:22: note:   initializing argument 1 of ‘void fillMatrix(int*)’
 void fillMatrix(int *A)
                 ~~~~~^
stdout
Standard output is empty