Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <cstdio>
  4. #include <time.h>
  5. #include <windows.h>
  6.  
  7. using namespace std;
  8. void gotoxy(int x, int y)
  9. {
  10. COORD c;
  11. c.X = x-1;
  12. c.Y = y-1;
  13. SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
  14. }
  15. int t[5][5],i ,j,suma=0;
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. int main()
  23. {
  24. srand(time(NULL));
  25. for (i=0;i<5;i++){
  26. for (j=0;j<5;j++)
  27. {
  28. t[i][j] = rand()%5+1;
  29. suma= suma+ t[i][j];
  30. gotoxy((j+1)*4, (i+1)*2);
  31. cout<<t[i][j];
  32.  
  33. }
  34. cout<<endl;
  35. cout<<endl;
  36. }
  37. cout << "Suma rowna sie: " << suma << endl;
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement