-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment1.cpp
More file actions
39 lines (31 loc) · 836 Bytes
/
Assignment1.cpp
File metadata and controls
39 lines (31 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter number of elements: ";
cin >> n;
float A[50], B[50], U[50], I[50], C[50];
cout << "Enter fuzzy set A: ";
for (int i = 0; i < n; i++) cin >> A[i];
cout << "Enter fuzzy set B: ";
for (int i = 0; i < n; i++) cin >> B[i];
// Fuzzy Union: max(A, B)
cout << "\nUnion: ";
for (int i = 0; i < n; i++) {
U[i] = max(A[i], B[i]);
cout << U[i] << " ";
}
// Fuzzy Intersection: min(A, B)
cout << "\nIntersection: ";
for (int i = 0; i < n; i++) {
I[i] = min(A[i], B[i]);
cout << I[i] << " ";
}
// Fuzzy Complement: 1 - A
cout << "\nComplement of A: ";
for (int i = 0; i < n; i++) {
C[i] = 1 - A[i];
cout << C[i] << " ";
}
return 0;
}