Facebook
From kurwa, 7 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 238
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4. char *funkcja(double **t, double **t1, int n);
  5. int main()
  6. {
  7.         int n;
  8.         char *a;
  9.         cout << "podaj rozmiar tablicy nxn: " << endl;
  10.         cin >> n;
  11.         double **t = new double *[n];
  12.         for (int i = 0; i < n; i++)
  13.                 t[i] = new double[n];
  14.         cout << "wprowadz elementy tablicy nr 1" << endl;
  15.         for (int i = 0; i < n; i++)
  16.                 for (int j = 0; j < n; j++)
  17.                         {
  18.                         cin >> t[i][j];
  19.                         }
  20.        
  21.         double **t1 = new double *[n];
  22.         for (int i = 0; i < n; i++)
  23.                 t1[i] = new double[n];
  24.         cout << "wprowadz elementy tablicy nr 2" << endl;
  25.         for (int i = 0; i < n; i++)
  26.                 for (int j = 0; j < n; j++)
  27.                 {
  28.                         cin >> t1[i][j];
  29.                 }
  30.  
  31.         cout << "pokaz elementy tablicy nr 1" << endl;
  32.         for (int i = 0; i < n; i++)
  33.                 for (int j = 0; j < n; j++)
  34.                 {
  35.                         cout << t[i][j] << endl;
  36.                 }
  37.         cout << "pokaz elementy tablicy nr 2" << endl;
  38.         for (int i = 0; i < n; i++)
  39.                 for (int j = 0; j < n; j++)
  40.                 {
  41.                         cout << t1[i][j] << endl;
  42.                 }
  43.  
  44.          funkcja(t, t1, n);
  45.                 system("pause");
  46. }
  47.  
  48. char *funkcja(double **t, double **t1, int n)
  49. {
  50.         char **nowa=new char*[n];
  51.         for (int i = 0; i < n; i++)
  52.                 nowa[i] = new char[n];
  53.                
  54.                
  55.         for (int i = 0; i < n; i++)
  56.                 for (int j = 0; j < n; j++)
  57.                 {
  58.                         if (sizeof(t1[i][j]) == sizeof(static_cast<int>(t[i][j])))
  59.                                 nowa[i][j] = 'T';
  60.                         else nowa[i][j] = 'F';
  61.  
  62.                 }
  63.         cout << "Pokaz tablice T/F:" << endl;
  64.  
  65.         for (int i = 0; i < n; i++)
  66.                 for (int j = 0; j < n; j++)
  67.                         cout << nowa[i][j] << endl;
  68.        
  69.  
  70.         return *nowa;
  71. }