Advertisement
Guest User

Untitled

a guest
Oct 9th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <ctime>
  6. #include <stdlib.h>
  7. using namespace std;
  8.  
  9. int main()
  10.  
  11. {
  12.  
  13. int b, c;
  14.  
  15.  
  16. cout << "vv kolvo str(b) stb(c) (ravnie!!)" << endl; //êâàäðàò
  17. cin >> b >> c;
  18.  
  19. int **a = new int *[b];
  20. for (int i = 0; i < b; i++)
  21. a[i] = new int [c];
  22.  
  23.  
  24.  
  25. srand (time(NULL));
  26. int ne;
  27. for (int i = 0; i < b; i++)
  28. {
  29. for (int j = 0; j <c; j++)
  30.  
  31. a[i][j] = rand()%20-10;
  32.  
  33.  
  34.  
  35.  
  36.  
  37. }
  38.  
  39.  
  40. for (int i= 0; i < b; i++)
  41. {
  42. for(int j=0;j<c;j++)
  43. cout << setw(6) << a[i][j];
  44. cout << endl;
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. for(int j =0; j< b; j++)
  57.  
  58.  
  59. for (int i=0;i<c;i++)
  60. if (a[i][j]==0)
  61.  
  62. {
  63.  
  64. cout<<"tuta="<<j<<endl;
  65. goto endSe;
  66. }
  67. endSe: ;
  68.  
  69. int s=0;
  70. int e,h;
  71. int *g = new int[e];
  72.  
  73. for (int i=0;i<b;i++)
  74. {
  75. for (int j=0;j<c;j++)
  76. {
  77. if ( a[i][j]<0 && a[i][j]%2==0 ) // ñ÷èòàåò âåäü ÷åòíûå
  78. s = s + a[i][j]; }
  79.  
  80. int g[i];
  81. g[i]=s;
  82. cout<<"g["<<i<<"]"<<g[i]<<endl;
  83.  
  84.  
  85. s=0;
  86.  
  87. }
  88.  
  89.  
  90.  
  91.  
  92. for (int i=0;i<b;i++)
  93. {
  94. for(int j=0;j<b;j++)
  95. if(g[i]<g[i+1])
  96. cout<<setw(4)<<a[i][j];
  97. }
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110. return 0;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement