sorting1

sorting1 -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// Sorts the three first names of three people. #include <iostream> #include <string> using namespace std; string n1; string n2; string n3; int main() { cout<<"enter the first name"<<endl; cin>> n1; cout<<"enter the second name"<<endl; cin>> n2; cout<<"enter the third name"<<endl; cin>> n3; cout<<n1<<endl;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout&lt;&lt;n2&lt;&lt;endl; else if((n1&lt;n2)&amp;&amp;(n2&gt;n3)) cout&lt;&lt;n3&lt;&lt;endl; if((n1&gt;n2)&amp;&amp;(n2&lt;n3)) cout&lt;&lt;n1&lt;&lt;endl; else if((n1&lt;n2)&amp;&amp;(n2&lt;n3)) cout&lt;&lt;n2&lt;&lt;endl; else if((n1&gt;n2)&amp;&amp;(n2&lt;n3)) cout&lt;&lt;n3&lt;&lt;endl; if((n1&gt;n2)&amp;&amp;(n2&gt;n3)) cout&lt;&lt;n1&lt;&lt;endl; else if((n1&lt;n2)&amp;&amp;(n2&gt;n3)) cout&lt;&lt;n2&lt;&lt;endl; else if((n1&lt;n2)&amp;&amp;(n2&lt;n3)) cout&lt;&lt;n3&lt;&lt;endl; return 0; }...
View Full Document

Ask a homework question - tutors are online