/* * Copyright 2013 John Zahorjan * * This file is part of the UW CSE 333 course exercises (333exer). * * 333exer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * 333exer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with 333exer. If not, see . */ #include // for printf, NULL #include // for EXIT_SUCCESS #include "MultiSet.h" int main(int argc, char **argv) { int A_array[21] = {1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47,\ 53, 59, 61, 67, 71}; int B_array[21]; for (int i = 0; i < 21; i++) { B_array[i] = 2 * (i + 1); } MultiSet *A = multiset_new(21, A_array); MultiSet *B = multiset_new(21, B_array); MultiSet *C = multiset_union(A, B); for ( size_t i = 0; i < C->size; i++ ) { printf("%2u: %d\n", (unsigned int)i, C->valueVec[i]); } multiset_destroy(A); multiset_destroy(B); multiset_destroy(C); return EXIT_SUCCESS; // EXIT_SUCCESS defined in stdlib.h. }