Advertisement
Denny707

Untitled

Jul 13th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int j=3;
  8. int k=3;
  9. int h=3;
  10. int array[3][3][3];
  11.  
  12.  
  13.  
  14. int sottoprogramma() {
  15. int scalino1= array[0][0][0];
  16. int scalino2= array[1][1][1];
  17. int scalino3= array[2][2][2];
  18. int max;
  19.  
  20. if (scalino1>scalino2) {
  21. if (scalino1>scalino3) {
  22. max=scalino1;
  23. }
  24. else
  25. max=scalino3;
  26. }
  27. else {
  28. if (scalino2>scalino3) {
  29. max= scalino2;
  30. }
  31. else
  32. max=scalino3;
  33. }
  34. return max;
  35.  
  36.  
  37. }
  38.  
  39. int main () {
  40.  
  41. cout << "Inserisci 27 numeri interi: ";
  42. for (int i=0; i<j; i++) {
  43. for (int l=0; l<k; l++) {
  44. for (int m=0; m<h; m++) {
  45. cin >> array[i][l][m];
  46.  
  47. }
  48. }
  49. }
  50. cout<<sottoprogramma();
  51. system ("PAUSE");
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement