Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "sets.h"
- const size_t u_size = 10;
- const bool U[u_size] = { 1,1,1,1,1,1,1,1,1,1 };
- using namespace std;
- using namespace bset;
- void f(bool A[], bool B[], bool C[], size_t n, size_t m, size_t k, bool res[], size_t* r,const bool st[]);
- void wr_row(const bool A[]);
- int main()
- {
- setlocale(LC_ALL, "rus");
- bool empty_set[u_size];
- size_t size = u_size;
- addition(U, empty_set,&size, u_size);
- bool A[u_size] = { 0,1,0,0,0,0,0,0,1,1 };
- bool B[u_size] = { 1,1,0,0,0,0,0,1,1,1 };
- bool C[u_size] = { 1,0,1,0,0,1,1,0,0,0 };
- size_t m, n, k;
- n = 3;
- m = 5;
- k = 4;
- bool empty_f[u_size];
- bool U_f[u_size];
- size_t ef_size, uf_size;
- f(A, B, C, n, m, k, empty_f, &ef_size,empty_set);
- f(A, B, C, n, m, k, U_f, &uf_size, U);
- wr_row(empty_f);
- cout << endl;
- wr_row(U_f);
- system("pause");
- return 0;
- }
- void f(bool A[], bool B[], bool C[], size_t n, size_t m, size_t k, bool res[], size_t* r,const bool st[])
- {
- bool buf1[u_size];
- bool buf2[u_size];
- size_t b1_size = 0, b2_size = 0;
- union_set(A, st, buf1, &b1_size,u_size);
- difference(st,B, buf2, &b2_size, u_size);
- traversal(buf1, buf2, res, r, u_size);
- union_set(C, res, res, r, u_size);
- addition(st, buf1, &b1_size, u_size);
- traversal(A, buf1, buf1, &b1_size, u_size);
- difference(C, st, buf2, &b2_size, u_size);
- sym_difference(buf1, buf2, buf1, &b1_size, u_size);
- sym_difference(res, buf1, res, r, u_size);
- }
- void wr_row(const bool A[])
- {
- cout << "Элементы множества: ";
- for (int i = 0; i < u_size; i++)
- if (A[i]) cout << i+1 << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement