Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <time.h>
- #include <windows.h>
- using namespace std;
- int main(int argc, char** argv) {
- srand(time(0));
- int t[4][5],x=0, s=0, s2=0,k, tt[4];
- for(int j=0; j<4; j++)
- {
- for(int i=0; i<5; i++)
- {
- x=(std::rand() %19) - 9;
- t[j][i]=x;
- }
- }
- for(int w=0; w<4; w++)
- {
- for(int k=0; k<5; k++)
- {
- cout<<t[w][k]<<" ";
- s2=s2+t[w][k];
- }
- cout<<"| Suma wiersza wynosi: "<<s2<<endl;
- tt[w]=s2;
- s2=0;
- }
- cout<<endl<<"Transpozycja\n\n";
- for(int w=0; w<5; w++)
- {
- for(int k=0; k<4; k++)
- {
- cout<<t[k][w]<<" ";
- s=s+t[k][w];
- }
- cout<<"| Suma wiersza wynosi: "<<s<<endl;
- s=0;
- }
- cout<<endl;
- for(int w=0; w<4; w++)
- {
- cout<<"Suma "<<w+1<<" kolumny wynosi: "<<tt[w]<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement