-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuniao.cpp
More file actions
39 lines (33 loc) · 701 Bytes
/
Copy pathuniao.cpp
File metadata and controls
39 lines (33 loc) · 701 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
//Mateus Freitas help done
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main()
{
int a[4] = {1,2,3,4}, b[4] = {3,4,5,6};
int c[8], k=0, existe;
for(int i=0; i<4; i++) {
existe=0;
for(int j=0; j<k; j++) {
if (a[i] == c[j])
existe=1;
}
if(existe == 0)
c[k++] = a[i];
}
for(int i=0; i<4; i++) {
existe=0;
for(int j=0; j<k; j++) {
if (b[i] == c[j])
existe=1;
}
if(existe == 0)
c[k++] = b[i];
}
for(int i=0; i<k; i++) {
printf("%d ", c[i]);
}
printf("\n");
return 0;
}