sorting1 - cout<<n2<<endl else...

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<<n2<<endl; else if((n1<n2)&&(n2>n3)) cout<<n3<<endl; if((n1>n2)&&(n2<n3)) cout<<n1<<endl; else if((n1<n2)&&(n2<n3)) cout<<n2<<endl; else if((n1>n2)&&(n2<n3)) cout<<n3<<endl; if((n1>n2)&&(n2>n3)) cout<<n1<<endl; else if((n1<n2)&&(n2>n3)) cout<<n2<<endl; else if((n1<n2)&&(n2<n3)) cout<<n3<<endl; return 0; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online