Answer to Question #30899 in C++ for omer moiz

Question #30899
Write a Computer Program in c++ that Checks Whether a given Set is the Subset of another Set or Not?
1
Expert's answer
2013-05-22T10:36:19-0400
#include <iostream>
#include <memory.h>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>

using namespace std;

int n, m;
int a[10000];
int b[10000];

void read(int A[], int &x) {
cin >> x;
for (int i = 0; i < x; i++)
& cin >> A[i];
}

int main()
{
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
read(a, n);
read(b, m);
sort(a, a + n);
sort(b, b + m);
cout << includes(a, a + n, b, b + m);
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS