Facebook
From Obese Leopard, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 222
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <math.h>
  4. #include <ctime>
  5. using namespace std;
  6.  
  7. int random () {
  8.         int min=5;
  9.         int max=20;
  10.         int r = min+rand()%(max-(min)+1);
  11.         return r;
  12. }
  13. main() {
  14.         int A[2][3] , B[3][2] , C[2][2];
  15.         for(int i=0;i<2;i++){
  16.                         for(int j=0;j<3;j++) {
  17.                                 A[i][j] = random();
  18.                                
  19.                                
  20.                         }
  21.                 }
  22.                 for(int i=0;i<3;i++){
  23.                         for(int j=0;j<2;j++) {
  24.                                 B[i][j] = random();
  25.                                
  26.                         }
  27.                 }
  28.                 cout<<"Tabela A: "<<endl;
  29.                 for(int i=0;i<2;i++) {
  30.                         for(int j=0;j<3;j++) {
  31.                                 cout<<A[i][j]<<" ";
  32.                         }
  33.                         cout<<endl;
  34.                 }
  35.                 cout<<"Tabela B: "<<endl;
  36.                 for(int i=0;i<3;i++) {
  37.                         for(int j=0;j<2;j++) {
  38.                                 cout<<B[i][j]<<" ";
  39.         }
  40.         cout<<endl;    
  41. }
  42. for(int i-0;i<2;i++) {
  43.         int a=0;
  44.         for(int j=0;j<3;j++) {
  45.                
  46.         }
  47. }
  48. }
  49.  
  50.  
  51.         /*
  52. }
  53. int main() {
  54.         srand(time(NULL));
  55.         int min, max;
  56.         int A[3][2], B[3][2], C[3][2];
  57.         cout<<"Podaj liczbe min: ";
  58.         cin>>min;
  59.         cout<<"Podaj liczbe max: ";
  60.         cin>>max;
  61.         for(int i=0;i<3;i++){
  62.                         for(int j=0;j<2;j++) {
  63.                                 A[i][j] = random(min,max);
  64.                                 B[i][j] = random(min,max);
  65.                                
  66.                         }
  67.                 }
  68.                 cout<<"Tabela A: "<<endl;
  69.                 for(int i=0;i<3;i++) {
  70.                         for(int j=0;j<2;j++) {
  71.                                 cout<<A[i][j]<<" ";
  72.                         }
  73.                         cout<<endl;
  74.                 }
  75.                 cout<<"Tabela B: "<<endl;
  76.                 for(int i=0;i<3;i++) {
  77.                         for(int j=0;j<2;j++) {
  78.                                 cout<<B[i][j]<<" ";
  79.         }
  80.         cout<<endl;
  81. }
  82. for(int i=0;i<3;i++){
  83.         for(int j=0;j<2;j++) {
  84.                 C[i][j] = A[i][j] + B[i][j];
  85.         }
  86. }
  87. cout<<"A+B "<<endl;
  88. for(int i=0;i<3;i++) {
  89.         for(int j=0;j<2;j++) {
  90.                 cout<<C[i][j]<<" ";
  91.         }
  92.         cout<<endl;
  93. }
  94. for(int i=0;i<3;i++){
  95.         for(int j=0;j<2;j++) {
  96.                 C[i][j] = A[i][j] - B[i][j];
  97.         }
  98. }
  99. cout<<"A-B "<<endl;
  100. for(int i=0;i<3;i++) {
  101.         for(int j=0;j<2;j++) {
  102.                 cout<<C[i][j]<<" ";
  103.         }
  104.         cout<<endl;
  105. }
  106. }
  107. */
  108.