Delphi-int.ru: портал программистов

Вход Регистрация | Забыли пароль?

Просмотр кода

Идентификатор: 8ea6a4ed Код загружен: 23 октября 2010, 01:44 (IlluminatI)

  1. /*
  2.  * File: main.cpp
  3.  * Author: Tema
  4.  *
  5.  * Created on 23 Октябрь 2010 г., 01:34
  6.  */
  7.  
  8. #include <math.h>
  9. #include <stdlib.h>
  10. #include <stdio.h>
  11. #include <iostream.h>
  12. #include <iomanip.h>
  13.  
  14.  
  15. int main(int argc, char** argv)
  16. {
  17.  
  18. int A[10][10];
  19.  
  20.  
  21. for (int i = 0; i < 10; i++)
  22. {
  23. for (int j = 0; j<10; j++)
  24. {
  25. A[i][j] =(int)(-5+rand()%3);
  26. cout << A[i][j] << " ";
  27. }
  28. cout << "\n";
  29. }
  30.  
  31. int max = 0;
  32. int ind_i, ind_j = 0;
  33.  
  34. for (int j = 0; j<10; j++)
  35. {
  36. max = abs(A[0][j]);
  37. ind_i = 0;
  38. ind_j = j;
  39. for (int i = 1; i<10; i++)
  40. {
  41. if (abs(A[i][j])>max)
  42. {
  43. max = abs(A[i][j]);
  44. ind_i = i;
  45. ind_j = j;
  46. }
  47. }
  48. cout << "V stolbce " << j << " max element = " << max << " mesto: " << ind_i << "," << ind_j << "\n";
  49. }
  50.  
  51. return (EXIT_SUCCESS);
  52. }

Ссылка на данный код:

На главную страницу сервиса обмена кодом »