Note that there are some explanatory texts on larger screens.

plurals
  1. POcombine two list into one list
    primarykey
    data
    text
    <p>I am trying to solve this problem: <a href="https://stackoverflow.com/questions/268079/search-multiple-list-for-missing-entries">Search multiple list for missing entries</a>. I used a multimap for duplication of keys. Here is my code:</p> <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;list&gt; #include &lt;utility&gt; using namespace std; int main(){ list&lt;char&gt;a; list&lt;int&gt; b; multimap&lt;char,int&gt;s; a.push_back('A'); a.push_back('B'); a.push_back('C'); b.push_back(1); b.push_back(2); b.push_back(3); s.insert(std::pair&lt;char,int&gt;('A',1)); s.insert(std::pair&lt;char,int&gt;('A',2)); s.insert(std::pair&lt;char,int&gt;('B',2)); s.insert(std::pair&lt;char,int&gt;('B',3)); s.insert(std::pair&lt;char,int&gt;('C',1)); s.insert(std::pair&lt;char,int&gt;('C',3)); list&lt;char&gt;::iterator it; list&lt;int&gt;::iterator IT; multimap&lt;char,int&gt;::iterator i; for (i=s.begin();i!=s.end();i++){ for (IT=b.begin();IT!=b.end();IT++){ i=s.find(*IT); if (i==s.end()){ cout&lt;&lt;(*i).first&lt;&lt; " "&lt;&lt;*IT&lt;&lt;endl; } } } return 0; } </code></pre> <p>It compiled but after I run it it stops running abnormally. I think I am not accessing elements correctly. Please help me. EDIT: i have updated my code</p> <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;list&gt; #include &lt;utility&gt; using namespace std; int main(){ list&lt;char&gt;a; list&lt;int&gt; b; multimap&lt;char,int&gt;s; a.push_back('A'); a.push_back('B'); a.push_back('C'); b.push_back(1); b.push_back(2); b.push_back(3); s.insert(std::pair&lt;char,int&gt;('A',1)); s.insert(std::pair&lt;char,int&gt;('A',2)); s.insert(std::pair&lt;char,int&gt;('B',2)); s.insert(std::pair&lt;char,int&gt;('B',3)); s.insert(std::pair&lt;char,int&gt;('C',1)); s.insert(std::pair&lt;char,int&gt;('C',3)); list&lt;char&gt;::iterator it; list&lt;int&gt;::iterator IT; multimap&lt;char,int&gt;::iterator i; for (it=a.begin();it!=a.end();it++){ for (i=s.begin();i!=s.end();i++){ for (IT=b.begin();IT!=b.end();IT++){ if ((*i).first==*it &amp;&amp; ((*i).second!=*IT)){ cout&lt;&lt;(*i).first&lt;&lt; " "&lt;&lt;*IT&lt;&lt;endl; } } } } return 0; } </code></pre> <p>but here is too much combination then i need so what is problem?i think it should work correctly</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload