Advertisement
Guest User

Untitled

a guest
Dec 20th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. int sumofmodules( int **s, int rows, int columns )
  2. {
  3.  
  4. int sum = 0;
  5. bool isEnought = false;
  6.  
  7. int DontGo = 0;
  8. int BlackAndBlue = 0;
  9.  
  10. for ( int i = 0; i < rows && !isEnought ; i++ )
  11. {
  12. for ( int j = 0; j < columns ; j++ )
  13. {
  14. if (s[i][j] > 0)
  15. {
  16. DontGo = i;
  17. BlackAndBlue = j;
  18. isEnought = true;
  19. break;
  20. }
  21. }
  22. }
  23.  
  24. for (int i = DontGo; i < rows ; i++)
  25. {
  26. for(int j = ++BlackAndBlue; j < columns ; j++)
  27. {
  28. sum += abs(s[i][j]);
  29. }
  30. BlackAndBlue = -1;
  31. }
  32. return sum;
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement