Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <cstdio>
- #include <time.h>
- #include <windows.h>
- using namespace std;
- void gotoxy(int x, int y)
- {
- COORD c;
- c.X = x-1;
- c.Y = y-1;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
- }
- int t[5][5],i ,j,suma=0;
- int main()
- {
- srand(time(NULL));
- for (i=0;i<5;i++){
- for (j=0;j<5;j++)
- {
- t[i][j] = rand()%5+1;
- suma= suma+ t[i][j];
- gotoxy((j+1)*4, (i+1)*2);
- cout<<t[i][j];
- }
- cout<<endl;
- cout<<endl;
- }
- cout << "Suma rowna sie: " << suma << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement