fork download
  1. #include <stdio.h>
  2.  
  3. int Nhapmang(int[], int);
  4. int Xuatmang(int[], int);
  5. int Lietke(int[], int);
  6.  
  7. int main()
  8. {
  9. int n;
  10. int a[100];
  11. Nhapmang(a, n);
  12. Xuatmang(a, n);
  13. printf("Cac gia tri chan trong mang la: ");
  14. Lietke(a, n);
  15. return 0;
  16. }
  17.  
  18. int Nhapmang(int a[], int &n)
  19. {
  20. printf("Nhap so phan tu: ");
  21. scanf("%d", &n);
  22. for (int i = 0; i < n; i++)
  23. {
  24. printf("Nhap a[%d]: ", i);
  25. scanf("%d", &a[i]);
  26. }
  27. }
  28.  
  29. int Xuatmang(int a[], int n)
  30. {
  31. for (int i = 0; i < n; i++)
  32. {
  33. printf("Mang vua nhap la: \n");
  34. printf("a[%d]= %4d", i, a[i]);
  35. }
  36. }
  37.  
  38. int Lietke(int a[], int n)
  39. {
  40. for (int i = 0; i < n; i++)
  41. {
  42. if (a[i] % 2 == 0)
  43. {
  44. printf("a[%d]=%4d", i, a[i]);
  45. }
  46. }
  47. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void Xuatmang(int*, int)’:
prog.cpp:29:6: error: ambiguating new declaration of ‘void Xuatmang(int*, int)’
 void Xuatmang(int a[], int n)
      ^~~~~~~~
prog.cpp:4:5: note: old declaration ‘int Xuatmang(int*, int)’
 int Xuatmang(int[], int);
     ^~~~~~~~
prog.cpp: In function ‘void Lietke(int*, int)’:
prog.cpp:38:6: error: ambiguating new declaration of ‘void Lietke(int*, int)’
 void Lietke(int a[], int n)
      ^~~~~~
prog.cpp:5:5: note: old declaration ‘int Lietke(int*, int)’
 int Lietke(int[], int);
     ^~~~~~
stdout
Standard output is empty