Advertisement
Skygen

9. darbs v2

Mar 25th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <conio.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int array[3][5] = {{1,2,3,4,5}, {1,2,3,4,5},{1,2,3,4,5}};
  10. for(int i = 0;i<3;i++){for(int j=0;j<5;j++){
  11. cout << array[i][j]; } cout << endl;}
  12. //=====================================================
  13. float array2[4][3];
  14. float count = 0;
  15. srand(time(0));
  16. for(int i = 0;i<4;i++){for(int j=0;j<3;j++){ array2[i][j] = rand()%1000/10.0; count=+array2[i][j]; } cout << i+1 << " rindas masiva elementu summa: " << count << endl; count = 0;}
  17. //=====================================================
  18. char array3[5][5];
  19. int count2[5][2]={{0,0},{0,0},{0,0},{0,0},{0,0}};
  20. int max = 0,max2 = 0;
  21.  
  22. for(int i = 0;i<5;i++){for(int j=0;j<5;j++){ do{ count = rand()%48+65;}while(count>90 && count<97);
  23. if(count<=90)count2[i][0]+=1;else count2[i][1]+=1;
  24. array3[j][i]= char(count);}
  25. if(count2[max][0]<count2[i][0]) max = i;
  26. if(count2[max2][1]<count2[i][1]) max2 = i; }
  27.  
  28. cout << "Mazako burtu skaits rinda: " << max+1 << endl;
  29. cout << "Lielako burtu skaits rinda: " << max2+1 << endl;
  30. //=====================================================
  31. int array4[6][10];
  32.  
  33. for(int i = 0;i<10;i++){for(int j=0;j<5;j++){ array4[j][i]=rand()%1000+1;
  34. if(j!=0){if(max<array4[j][i]) max = array4[j][i];} else max = array4[0][i];}
  35. array4[5][i] = max*=2;}
  36.  
  37. getch();
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement