Find Jobs
Hire Freelancers

A c++ program

$10-30 USD

Terminado
Publicado hace alrededor de 8 años

$10-30 USD

Pagado a la entrega
In the mathematical theory of sets, a set is defined as a collection of distinct items of the same type. In some programming languages, sets are built-in data type; unfortunately, this is not the case in C++. However, we can simulate a set using a one-dimensional array. Some operations can be performed on sets. We will consider only three of them: union, intersection, and difference. These are binary operations requiring two sets as operands. The union of two sets, A and B, is a set that contains elements that are in A and B. The intersection of two sets, A and B, is a set that contains elements common to both A and B. Finally, the difference of two sets, A and B, is a set that contains only the elements in A but not in B and excluding the common elements in A and B. For example, if A and B are two sets of integers defined as A = {5, 7, 8, 10} and B = {3, 9, 10}, then their union is the set {3, 5, 7, 8, 9, 10}, their intersection is the set {10}, and the difference of A and B is the set {5, 7, 8}. Write a program that computes the union, intersection, and difference of two sets stored in two one-dimensional arrays. Populate the arrays from the following input files: [login to view URL] 0 1 -3 5 -11 6 8 9 11 17 15 7 4 12 [login to view URL] 0 -1 3 7 -6 16 5 11 12 4 21 13 The output should be displayed on screen and in an output file. Prompt user for file names. No duplicates are allowed in union and intersection. The following functions must be used: void readfile_array(ifstream& a, ifstream& b int arraya[], int& asize, int arrayb[], int& bsize); void printarray(int array[], int size, ofstream& o); int diff (int a[], int b[], int dif[], int asize, int bsize); int duplicates (int array[], int d[], int size); int intersection (int a[], int b[], int asize, int bsize, int inter[]); int union (int a[], int b[], int asize, int bsize, int unions[]); void sort (int array[], int n); SAMPLE OUTPUT: Enter filenames=>[login to view URL] [login to view URL] [login to view URL] Array Elements in File A 0 1 -3 5 -11 6 8 9 11 17 15 7 4 12 Array Elements in File B 0 -1 3 7 -6 16 5 11 12 4 21 13 Sorted ArrayA -11 -3 0 1 4 5 6 7 8 9 11 12 15 17 Sorted ArrayB -6 -1 0 3 4 5 7 11 12 13 16 21 Difference from ArrayA and ArrayB -11 -3 1 6 8 9 15 17 Number of elements in intersection = 6 0 4 5 7 11 12 Number of elements in union = 26 -6 -1 0 3 4 5 7 11 12 13 16 21 -11 -3 0 1 4 5 6 7 8 9 11 12 15 17 Sorted intersection 0 4 5 7 11 12 Sorted union -11 -6 -3 -1 0 0 1 3 4 4 5 5 6 7 7 8 9 11 11 12 12 13 15 16 17 21 The Intersection of A and B (no duplicates) 0 4 5 7 11 12 The Union of A and B(no duplicates) -11 -6 -3 -1 0 1 3 4 5 6 7 8 9 11 12 13 15 16 17 21
ID del proyecto: 10333185

Información sobre el proyecto

8 propuestas
Proyecto remoto
Activo hace 8 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
Hi I am experienced C++ programmer and I can develop this program instantly. Kindly contact me to discuss further Waiting for quick response
$40 USD en 1 día
4,9 (24 comentarios)
3,8
3,8
8 freelancers están ofertando un promedio de $25 USD por este trabajo
Avatar del usuario
A proposal has not yet been provided
$15 USD en 1 día
4,9 (9 comentarios)
3,0
3,0
Avatar del usuario
Implement set data structure in C++ Programming Language using array. The duplicated elements will be removed from the set.
$25 USD en 1 día
5,0 (6 comentarios)
2,9
2,9
Avatar del usuario
Hi, Iam an electrical engineering student with programming and machine learning as my major. I can easily code this functionality in C++. Awaiting your response, Maaz Imran
$30 USD en 0 día
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
PALM BAY, United States
5,0
7
Forma de pago verificada
Miembro desde ene 28, 2016

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.