Aaa

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Aaa as PDF for free.

More details

  • Words: 3,742
  • Pages: 46
macierz #include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
dodawanie #include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
{ macierz m(9,9); print (m); system("PAUSE"); return EXIT_SUCCESS; } odejmowanie #include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
{for (int j=0;j<x.K();++j) cout<<x.m(i,j)<<"'"; cout<<endl; } } int main(int argc, char *argv[]) { macierz m(9,9); print (m); system("PAUSE"); return EXIT_SUCCESS; } mnozenie przez liczbe #include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
wynik.m1(x.m(i,j)*z,i,j); return wynik; }

//mnozenie przez liczbe

void print (macierz x) {for (int i=0;i<x.W();++i) {for (int j=0;j<x.K();++j) cout<<x.m(i,j)<<"'"; cout<<endl; } } int main(int argc, char *argv[]) { macierz m(9,9); print (m); system("PAUSE"); return EXIT_SUCCESS; }

#include #include #include using namespace std; class macierz { private: int w; int k; float**t; public: macierz(int w1, int k1) { w=w1; k=k1; t=new float*[w]; for(int i=0; i<w; ++i) t[i]=new float [k]; for(int i=0; i<w; ++i) for(int j=0; j
include #include #include using namespace std; class macierz { private: int w; int k; float**t; public: macierz(int w1, int k1) { w=w1; k=k1; t=new float*[w]; for(int i=0; i<w; ++i) t[i]=new float [k]; for(int i=0; i<w; ++i) for(int j=0; j
print(m);

system("PAUSE"); return EXIT_SUCCESS; }

#include #include #include using namespace std; class macierz { private: int w; int k; float**t; public: macierz(int w1, int k1) { w=w1; k=k1; t=new float*[w]; for(int i=0; i<w; ++i) t[i]=new float [k]; for(int i=0; i<w; ++i) for(int j=0; j
{ for(int i=0; i<m.W(); ++i) { for(int j=0; j<m.K(); ++j) cout<<m.m(i,j)<<","; cout<<endl; } }; int main(int argc, char *argv[]) { macierz m1(3,2); macierz m2(3,2); macierz m3=suma(m1,m2); print(m3); system("PAUSE"); return EXIT_SUCCESS; }

transponowanie macierzy #include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
macierz m(6,3); macierz m3=t (m); print (m); cout<<endl; print (m3); system("PAUSE"); return EXIT_SUCCESS; }

#include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
{ macierz x(6,6); macierz y(6,6); macierz z (6,6); z=il(z,y); print (x); cout<<endl; print (y); cout<<endl; print (z); cout<<endl; system("PAUSE"); return EXIT_SUCCESS; }

#include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
int main(int argc, char *argv[]) {srand(time(NULL)); macierz x(2,2); macierz y(2,2); macierz z (2,2); z=il(z,y); print (x); cout<<endl; print (y); cout<<endl; print (z); cout<<endl; system("PAUSE"); return EXIT_SUCCESS; }

#include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
int main(int argc, char *argv[]) { srand(time(NULL)); macierz x(2,2); macierz y(2,2); macierz z (2,2); z=il(x,y); print (x); cout<<endl; print (y); cout<<endl; print (z); cout<<endl; system("PAUSE"); return EXIT_SUCCESS;}

potega macierzy #include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
z=il(z,x); return z;}; void print (macierz x) {for (int i=0;i<x.W();++i) {for (int j=0;j<x.K();++j) cout<<x.m(i,j)<<"|"; cout<<endl; } } int main(int argc, char *argv[]) { srand(time(NULL)); macierz x(2,2); macierz z(2,2); z=potega(x,2); print (x); cout<<endl; print (z); cout<<endl; cout<<endl; system("PAUSE"); return EXIT_SUCCESS; }

#include #include #include using namespace std; class macierz { private: int w; int k; float**t; public: macierz(int w1, int k1) { w=w1; k=k1; t=new float*[w]; for(int i=0; i<w; ++i) t[i]=new float [k]; for(int i=0; i<w; ++i) for(int j=0; j
macierz wynik(x.K(),x.W()); for(int i=0; i<x.K(); ++i) for(int j=0; j<x.W(); ++j) wynik.m1(x.m(j,i),i,j); return wynik; }; macierz il(macierz x, macierz y) { if(x.W()==y.K()) { macierz z(x.W(),y.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) { float t=0; for(int k=0; k<x.K(); ++k) t=x.m(i,k)*y.m(k,j)+t; z.m1(t,i,j); } return z; } }; macierz potega (macierz x, int n) { macierz z(z.W(), x.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) if(i==j) z.m1(1,i,i); else z.m1(0,i,j); for(int i=0; i
void print(macierz m) { for(int i=0; i<m.W(); ++i) { for(int j=0; j<m.K(); ++j) cout<<m.m(i,j)<<","; cout<<endl; } };

int main(int argc, char *argv[]) { macierz m1(3,2); macierz m2(3,2); macierz m3=suma(m1,m2); print(m3); cout<<endl; print(m2); cout<<endl; macierz m4=trans(m2); print(m4); cout<<endl; macierz x(2,2); macierz y(2,2); macierz z(2,2); z=il(x,y); print(x); print(y); print(z); cout<<endl; z=potega(x,2); print(x); print(z); cout<<endl; system("PAUSE"); return EXIT_SUCCESS; }

1. #include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
} ostream & operator<<(ostream &w, macierz m) { for (int i=0; i<m.W();++i) { for (int j=0; j<m.K();++j) w<<m.m(i,j)<<"|"; w<<endl; } return w; } int main(int argc, char *argv[]) { srand(time(NULL)); macierz x(2,2); macierz y(2,2); macierz z (2,2); z=il(x,y); print (x); cout<<endl; print (y); cout<<endl; print (z); cout<<endl; system("PAUSE"); return EXIT_SUCCESS; }

2. 2. #include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w];

for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
int main(int argc, char *argv[]) { srand(time(NULL)); macierz x(2,2); macierz y(2,2); macierz z (2,2); macierz m (2,2); macierz w (2,2); z=il(x,y); print (x); cout<<endl; print (y); cout<<endl; print (z); cout<<endl; print (w); cout<<endl; print (m); system("PAUSE"); return EXIT_SUCCESS; }

#include #include #include using namespace std; class macierz { private: int w; int k; float**t; public: macierz(int w1, int k1) { w=w1; k=k1; t=new float*[w]; for(int i=0; i<w; ++i) t[i]=new float [k]; for(int i=0; i<w; ++i) for(int j=0; j
macierz wynik(x.K(),x.W()); for(int i=0; i<x.K(); ++i) for(int j=0; j<x.W(); ++j) wynik.m1(x.m(j,i),i,j); return wynik; }; macierz il(macierz x, macierz y) { if(x.W()==y.K()) { macierz z(x.W(),y.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) { float t=0; for(int k=0; k<x.K(); ++k) t=x.m(i,k)*y.m(k,j)+t; z.m1(t,i,j); } return z; } }; macierz potega (macierz x, int n) { macierz z(z.W(), x.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) if(i==j) z.m1(1,i,i); else z.m1(0,i,j); for(int i=0; i
{ for(int i=0; i<m.W(); ++i) { for(int j=0; j<m.K(); ++j) w<<m.m(i,j)<<"|"; w<<endl; } return w; }; macierz operator *(macierz x, macierz y) { return il(x,y); }; macierz operator +(macierz x, macierz y) { return suma(x,y); }; int main(int argc, char *argv[]) { macierz m(2,2); macierz w(2,2); macierz z(2,2); cout<<m<<endl; cout<
#include #include #include using namespace std; class macierz { private: int w; int k; float**t; public: macierz(int w1, int k1) { w=w1; k=k1; t=new float*[w]; for(int i=0; i<w; ++i) t[i]=new float [k]; for(int i=0; i<w; ++i) for(int j=0; j
macierz wynik(x.K(),x.W()); for(int i=0; i<x.K(); ++i) for(int j=0; j<x.W(); ++j) wynik.m1(x.m(j,i),i,j); return wynik; }; macierz il(macierz x, macierz y) { if(x.W()==y.K()) { macierz z(x.W(),y.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) { float t=0; for(int k=0; k<x.K(); ++k) t=x.m(i,k)*y.m(k,j)+t; z.m1(t,i,j); } return z; } }; macierz potega (macierz x, int n) { macierz z(z.W(), x.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) if(i==j) z.m1(1,i,i); else z.m1(0,i,j); for(int i=0; i
{ for(int i=0; i<m.W(); ++i) { for(int j=0; j<m.K(); ++j) w<<m.m(i,j)<<"|"; w<<endl; } return w; }; macierz operator *(macierz x, macierz y) { return il(x,y); }; macierz operator +(macierz x, macierz y) { return suma(x,y); }; macierz operator ^(macierz x, int n) { return potega(x,n); }; int main(int argc, char *argv[]) { macierz m(2,2); macierz w(2,2); macierz z(2,2); cout<<m<<endl; cout<
#include #include #include using namespace std; class macierz{ private: int w; // wiesze int k; // kolumny float **t; // tablica wskazników public: macierz(int w1, int k1){ w=w1; k=k1; t=new float*[w]; for(int i=0;i<w;++i) t[i]=new float[k]; for(int i=0;i<w;++i) for(int j=0;j
macierz wynik(x.W(), x.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) wynik.m1(x.m(i,j)+y.m(i,j),i,j); return wynik; } }; macierz mn(macierz x, float t){ macierz wynik(x.W(), x.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) wynik.m1(x.m(i,j)*t,i,j); return wynik; }; macierz T(macierz x){ macierz wynik(x.K(), x.W()); for(int i=0; i<x.K(); ++i) for(int j=0; j<x.W(); ++j) wynik.m1(x.m(i,j),j,i); return wynik; }; macierz il(macierz x, macierz y){ if (x.K()==y.W()){ macierz W(x.W(), y.K()); for( int i=0; i<x.W(); ++i) for( int j=0; j<x.K(); ++j){ float t=0; for(int k=0;k<x.K(); ++k) t=t+x.m(i,k)*y.m(k,j); W.m1(t,i,j); }; return W;} }; macierz potega(macierz x, int n){ macierz Z(x.K(),x.W()); for(int i = 0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) if(i==j) Z.m1(1,i,i); else Z.m1(0,i,j); for(int i=0; i
for ( int i=0; i<m.W(); ++i){ for(int j=0; j<m.K(); ++j) w<<m.m(i,j)<<"|"; w<<endl; } return w; }; //macierz operator *(macierz x, macierz y){ // return il(x,y); //}; macierz operator +(macierz x, macierz y){ return suma(x,y); }; macierz operator ^(macierz x, int n){ return potega(x,n); }; macierz operator *(macierz x, float t){ return mn(x,t); }; int main(int argc, char *argv[]) { macierz m(2,2); macierz w(2,2); macierz z(2,2); cout<<((z*3+w+m*2)^10); //srand(time(NULL)); //macierz x(10,10); //print (x); //cout<<"----------------------------------------------"<<endl; //macierz z(10,10); //z = potega(x,3); //print (z); //cout<<"----------------------------------------------"<<endl; system("PAUSE"); return EXIT_SUCCESS; } ---------- Wiadomość przekazana dalej ---------From: Konrad Marek To: maciek <[email protected]> Date: Thu, 26 Mar 2009 18:02:41 +0100

Subject: aa #include #include #include using namespace std; class macierz{ private: int w; // wiesze int k; // kolumny float **t; // tablica wskazników public: macierz(int w1, int k1){ w=w1; k=k1; t=new float*[w]; for(int i=0;i<w;++i) t[i]=new float[k]; for(int i=0;i<w;++i) for(int j=0;j
if((x.W()==y.W())&&(x.K()==y.K())){ macierz wynik(x.W(), x.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) wynik.m1(x.m(i,j)+y.m(i,j),i,j); return wynik; } }; macierz mn(macierz x, float t){ macierz wynik(x.W(), x.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) wynik.m1(x.m(i,j)*t,i,j); return wynik; }; macierz T(macierz x){ macierz wynik(x.K(), x.W()); for(int i=0; i<x.K(); ++i) for(int j=0; j<x.W(); ++j) wynik.m1(x.m(i,j),j,i); return wynik; }; macierz il(macierz x, macierz y){ if (x.K()==y.W()){ macierz W(x.W(), y.K()); for( int i=0; i<x.W(); ++i) for( int j=0; j<x.K(); ++j){ float t=0; for(int k=0;k<x.K(); ++k) t=t+x.m(i,k)*y.m(k,j); W.m1(t,i,j); }; return W;} }; macierz potega(macierz x, int n){ macierz Z(x.K(),x.W()); for(int i = 0; i<x.W(); ++i) for(int j=0; j<x.K(); ++j) if(i==j) Z.m1(1,i,i); else Z.m1(0,i,j); for(int i=0; i
ostream & operator<<(ostream & w, macierz m){ for ( int i=0; i<m.W(); ++i){ for(int j=0; j<m.K(); ++j) w<<m.m(i,j)<<"|"; w<<endl; } return w; }; //macierz operator *(macierz x, macierz y){ // return il(x,y); //}; macierz operator +(macierz x, macierz y){ return suma(x,y); }; macierz operator ^(macierz x, int n){ return potega(x,n); }; macierz operator *(macierz x, float t){ return mn(x,t); }; int main(int argc, char *argv[]) { macierz m(2,2); macierz w(2,2); macierz z(2,2); cout<<((z*3+w+m*2)^10); //srand(time(NULL)); //macierz x(10,10); //print (x); //cout<<"----------------------------------------------"<<endl; //macierz z(10,10); //z = potega(x,3); //print (z); //cout<<"----------------------------------------------"<<endl; system("PAUSE"); return EXIT_SUCCESS;}

#include #include #include using namespace std; class macierz {private: int w; int k; float**t; public: macierz(int w1, int k1) {w=w1; k=k1; t=new float*[w]; for (int i=0;i<w;++i) t[i]=new float[k]; for (int i=0;i<w;++i) for (int j=0;j
return z;}; macierz suma (macierz x, macierz y) {if ((x.W()==y.W())&&(x.K()==y.K())) { macierz wynik (x.W(),x.K()); for(int i=0;i<x.W();++i) for(int j=0;j<x.K();++j) wynik.m1(x.m(i,j)+y.m(i,j),i,j); return wynik; } } macierz odejmowanie (macierz x, macierz y) {if ((x.W()==y.W())&&(x.K()==y.K())) { macierz wynik (x.W(),x.K()); for(int i=0;i<x.W();++i) for(int j=0;j<x.K();++j) wynik.m1(x.m(i,j)-y.m(i,j),i,j); return wynik; } } macierz mnozenie (macierz x, float z) { macierz wynik (x.W(),x.K()); for(int i=0;i<x.W();++i) for(int j=0;j<x.K();++j) wynik.m1(x.m(i,j)*z,i,j); return wynik; } macierz t (macierz x)

//transponowanie

{ macierz wynik (x.K(),x.W()); for(int i=0;i<x.K();++i) for(int j=0;j<x.W();++j) wynik.m1(x.m(j,i),i,j); return wynik; } void print (macierz x) {for (int i=0;i<x.W();++i) {for (int j=0;j<x.K();++j) cout<<x.m(i,j)<<"|"; cout<<endl; } }

//mnozenie przez liczbe

ostream& operator<<(ostream& W, macierz M) {for (int i=0;i<M.W();++i) {for (int j=0;j<M.K();++j) W<<M.m(i,j)<<"|"; W<<endl; } return W; } macierz operator *(macierz x, macierz y) {return il(x,y); }; macierz operator +(macierz x, macierz y) {return suma(x,y); }; macierz operator -(macierz x, macierz y) {return odejmowanie(x,y); }; macierz operator ^(macierz x, int n) {return potega (x,n); }; macierz operator *(macierz x, float z) {return mnozenie (x,z); }; macierz operator ++(macierz x) {return t (x); }; int main(int argc, char *argv[]) { srand(time(NULL)); macierz m(2,2); macierz w(2,2); macierz z(2,2); cout<<m<<endl; cout<<w<<endl; cout<
znalezione #include #include #include using namespace std; class macierz { private: int w; int k; float**t; public: void M(int i, int j, float x) { t[i][j]=x; }; void m1(float x, int i, int j) { t[i][j]=x; } macierz(int w1, int k1) { w=w1; k=k1; t= new float*[w]; for (int i=0; i<w; ++i) t[i]= new float[k]; for(int i=0; i<w; ++i) for(int j=0; j
for(int i=0; i<m.W();++i) { for(int j=0; j<m.K();++j) cout<<m.M(i,j)<<" | "; cout<<endl; } }; ostream& operator<<(ostream&W, macierz M) { print(M); return W; };

macierz il(macierz x, macierz y) { if(x.W()==y.K()) { macierz z(x.W(),y.K()); for(int i=0; i<x.W(); ++i) for(int j=0; j<x.K();++j) { float t=0; for (int k=0; k<x.K();++k) t=x.M(i,k)*y.M(k,j)+t; z.m1(t,i,j);} return z; }}; /*macierz operator *(macierz x, macierz y) { return il(x,y); };*/ macierz potega(macierz x, int n) { macierz z(x.W(), x.K()); for(int i=0; i<x.W();++i) for(int j=0; j<x.K(); ++j) if (i==j) z.m1(1,i,i); else z.m1(0,i,j); for(int i=0; i
macierz operator ^ (macierz x, int n) { return potega (x,n); } macierz suma(macierz x, macierz y) { if((x.W()==y.W())&&(x.K()==y.K())) { macierz wynik(y.W(), y.K()); for(int i=0; i<x.W();++i) for(int j=0; j<x.K();++j) wynik.m1(x.M(i,j)+y.M(i,j), i, j); return wynik; } }; macierz operator + (macierz x, macierz y) {return suma(x,y); } macierz roznica(macierz x, macierz y) { if((x.W()==y.W())&&(x.K()==y.K())) { macierz wynik(y.W(), y.K()); for(int i=0; i<x.W();++i) for(int j=0; j<x.K();++j) wynik.m1(x.M(i,j)-y.M(i,j), i, j); return wynik; } }; macierz operator -(macierz x, macierz y) { return roznica(x,y); } macierz operator *(float y, macierz x) { macierz W(x.W(), x.K()); for(int i=0; i<x.W();++i) for(int j=0; j<x.K(); ++j) x.M(i,j, y* x.M(i,j)); return W; }; macierz T(macierz x) { macierz wynik(x.K(), x.W()); for(int i=0; i<x.K();++i) for(int j=0; j<x.W();++j) wynik.m1(x.M(j,i), i, j); return wynik; }; macierz operator --(macierz m) {

return T(m); }; int main(int argc, char *argv[]) { srand(time(NULL)); macierz M(3,3); macierz S(2,2); //cout<<M-S<<endl; cout<<M<<endl; //cout<<S<<endl; //cout<<3*M<<endl; //cout<<M+S; //cout<<M<<endl; //cout<<(M^2)<<endl; cout<<--(3*M)<<endl; //cout<<M*M<<endl;

system("PAUSE"); return EXIT_SUCCESS; }

Related Documents

Aaa
May 2020 10
Aaa
August 2019 17
Aaa
November 2019 12
Aaa
November 2019 13
Aaa
June 2020 12
Aaa
October 2019 27