From 959eb7db1384fe09cb8f32d89733c7e1d80de726 Mon Sep 17 00:00:00 2001 From: Shreya Pawaskar <55914007+shraiyya@users.noreply.github.com> Date: Fri, 25 Oct 2019 09:52:01 +0530 Subject: [PATCH] set_operations_arrays.cpp Performs operations on sets using 1 dimensional array --- operations on sets | 141 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 operations on sets diff --git a/operations on sets b/operations on sets new file mode 100644 index 0000000..7002c97 --- /dev/null +++ b/operations on sets @@ -0,0 +1,141 @@ +#include +using namespace std; +class set +{ + int set_array[10]; + int size; + int i; + int j=0; + int k=0; + int m=0; + int flag=0; +public: + void accept(); + void display(); + void intersect(set B); + void uniset(set B); + void subtract(set B); +}; + void set::accept() + { + cout<>size; + cout<<"enter elements "<>set_array[i]; + } + } +void set::display() +{ + cout<<"elements are"<>choice; + switch(choice) + { + case 1: + A.intersect(B); + break; + case 2: + A.uniset(B); + break; + case 3: + A.subtract(B); + break; + } +} + while(choice!=0); +return 0; +}