Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I've problem with the string class when i want to classify words

Status
Not open for further replies.

Cyrille

Programmer
Jun 22, 2000
2
FR
I want to alphabetize words in my program but there was some&nbsp;&nbsp;&nbsp;problem when i transfer to my executable.<br><br>i join the source if someone can help me. Thanks<br><br>#include &lt;deque&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;string&gt;<br><br>using namespace std;<br><br><br>deque&lt;string&gt; liste;<br><br>void in()<br>{<br><br>liste.insert(liste.begin(),&quot;q&quot;);<br>liste.insert(liste.begin(),&quot;w&quot;);<br>liste.insert(liste.begin(),&quot;c&quot;);<br>liste.insert(liste.begin(),&quot;d&quot;);<br>liste.insert(liste.begin(),&quot;b&quot;);<br>liste.insert(liste.begin(),&quot;s&quot;);<br>}<br><br>void tri(deque&lt;string&gt;* liste)<br>{<br>sort(liste-&gt;begin(),liste-&gt;end());<br>}<br><br>void trir(deque&lt;string&gt;* liste)<br>{<br><br>sort( liste-&gt;rbegin(), liste-&gt;rend());<br>}<br><br>template &lt;class It, class It2&gt;<br>&nbsp;void print_current_hand(It start, It2 end)<br>&nbsp;{<br>&nbsp;&nbsp;&nbsp;while (start &lt; end)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; *start++ &lt;&lt; endl;<br>&nbsp;}<br><br>void main()<br>{<br> in();<br>&nbsp;&nbsp;&nbsp;print_current_hand(liste.begin(),liste.end());<br><br>&nbsp;&nbsp;&nbsp;tri(&liste);<br>&nbsp;&nbsp;&nbsp;print_current_hand(liste.begin(),liste.end());<br><br>&nbsp;&nbsp;&nbsp;trir(&liste);<br>&nbsp;&nbsp;&nbsp;print_current_hand(liste.begin(),liste.end());<br>}<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top