Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8975259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:49:56+00:00 2026-06-15T18:49:56+00:00

I’m new to C++ and I need some help creating this program: I need

  • 0

I’m new to C++ and I need some help creating this program:
I need to ask for the size of the list, then take the list containing integers and then ask the size of the second list and take those integers.

So far I have this:

#include <iostream>
using namespace std;
int main()

{
long int ARR[10];
int i,n;

printf("List 1 size: ");
scanf("%d",&n);

printf("List 1 data: ");
for(i=0;i<n;i++)
{
    scanf("%ld",&ARR[i]);

}

So that will take the input for the first list. Now I will repeat this for the second list.
But the key point is I now need to compare the two lists. If list1 is in list2 then I say yay, or if not then nay.

How do I go about comparing these two lists? And I am I on the right track with the input?

Thanks,

EmptyPeace

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:49:57+00:00Added an answer on June 15, 2026 at 6:49 pm

    I think that’s what you expected.

    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <utility>
    
    using namespace std;
    
    bool mypredicate (int i, int j) {
      return (i==j);
    }
    
    int main(){
        int size_list = 0;
        vector<int> list1, list2;
    
        cin >> size_list;
    
        list1.resize(size_list);
        list2.resize(size_list);
    
        cout << list1.size() << endl;
    
        for (int i = 0; i < size_list; i++)
            cin >> list1[i];
    
        for (int i = 0; i < size_list; i++)
            cin >> list2[i];
    
        pair<vector<int>::iterator,vector<int>::iterator> mypair;
        mypair = mismatch (list1.begin(), list1.end(), list2.begin(), mypredicate);
    
    
        if( mypair.first == list1.end() && mypair.second == list2.end() )
            cout << "are equals" << endl;
        else{
            cout << "aren't " << endl;
            cout << *mypair.first << ", " << *mypair.second << endl;
        }
    
        system("pause");
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.