Advertisement
dllbridge

Untitled

Feb 28th, 2023
934
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.63 KB | None | 0 0
  1.  
  2.  
  3.  
  4. #include <iostream>
  5. using namespace std;
  6.  
  7.  
  8. class Ct
  9. {
  10.    
  11.     public:
  12.    
  13.     int u;
  14.    
  15.     int aMatrix[3][3];
  16.    
  17.     char sz[123];
  18.    
  19.     Ct()
  20.     {
  21.        
  22.         cout << "Enter 9th int:";
  23.        
  24.         for(int i = 0; i < 3; i++)
  25.         {
  26.             for(int j = 0; j < 3; j++)
  27.             {
  28.                 cin >> aMatrix[i][j];
  29.                
  30.             }
  31.         }
  32.        
  33.     }
  34.      
  35.     void pr()
  36.     {
  37.         cout << endl;
  38.         for(int i = 0; i < 3; i++)
  39.         {
  40.             for(int j = 0; j < 3; j++)
  41.             {
  42.                 cout << aMatrix[i][j] <<" ";
  43.                
  44.             }
  45.             cout << endl;
  46.         }
  47.        
  48.     }
  49.    
  50. };
  51.  
  52. int check(Ct *p);  
  53.  
  54.    
  55.  
  56. ////////////////////////////////////////////////////////////////
  57. int main()                                                    //    
  58. {
  59.    
  60.    
  61.    
  62.    
  63.        
  64.     cout << "Enter the elements of the 1st matrix:\n";
  65.     Ct t1;
  66.     cout << "Enter the elements of the 2st matrix:\n";
  67.     Ct t2;
  68.    
  69.    
  70.     if(check(&t1) == 1)
  71.     {
  72.          t1.pr();
  73.          cout << endl;
  74.          t2.pr();
  75.     }
  76.     else
  77.     {
  78.          t2.pr();
  79.          cout << endl;
  80.          t1.pr();
  81.     }  
  82.  
  83.    
  84.    
  85. return 0;
  86. }
  87.  
  88.  
  89. /////////////////////////////////////////////////////////////////
  90. int check(Ct *p)                                               //    
  91. {
  92.    
  93.     if(p->aMatrix[0][0] == 1) return 1;
  94.    
  95. return 0;  
  96. }
  97.  
  98.  
  99.  
  100. /*
  101.  
  102. #include <iostream>
  103. using namespace std;
  104.  
  105.  
  106. struct Ct
  107. {
  108.    
  109.    
  110.     int u;
  111.    
  112.     char sz[123];
  113.    
  114.     Ct()
  115.     {
  116.        
  117.        
  118.        
  119.     }
  120.    
  121.     void print()
  122.     {
  123.        
  124.         cout << "u = " << u;
  125.        
  126.     }
  127.    
  128. }t1, t2;
  129.  
  130.  
  131.  
  132.    
  133.  
  134. ////////////////////////////////////////////////////////////////
  135. int main()                                                    //    
  136. {
  137.    
  138.     Ct t3,
  139.        t4; 
  140.        
  141.     t1.u = 12;  
  142.    
  143.     t1.print();
  144.        
  145.  
  146.    
  147.    
  148. return 0;
  149. }
  150.  
  151.  
  152. */
  153.  
  154.  
  155.  
  156.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement