Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- string company1[]{"Bantam Books","666 Fifth Ave","New York","NY"};
- string company2[]{"ETN Corporation","Rd 4, Box 659","Detroit","MI"};
- string company3[]{"Benjamin/Cummings","390 Bridge Pkwy","Redwood","CA"};
- string company4[]{"Intertext","2633 E.17th Ave","New York","NY"};
- string company5[]{"Addison Wesley","Rte 128","Reading","MA"};
- string company6[]{"Brady Pub","15 Columbus Cir","New York","NY"};
- string company7[]{"Gale","835 Penobscot","Redwood","CA"};
- string company8[]{"ACM","11W. 42nd St.","New York","NY"};
- string company9[]{"Keegan Tech","63 Hillside Ave","Hamilton","ON",};
- cout<<"All Information"<<endl;
- cout<<left<<setw(20)<<"Name"<<setw(20)<<"Address"<<setw(20)<<"City"<<"State"<<endl;
- cout<<left<<setw(20)<<company1[0]<<setw(20)<<company1[1]<<setw(20)<<company1[2]<<company1[3]<<endl;
- cout<<left<<setw(20)<<company2[0]<<setw(20)<<company2[1]<<setw(20)<<company2[2]<<company2[3]<<endl;
- cout<<left<<setw(20)<<company3[0]<<setw(20)<<company3[1]<<setw(20)<<company3[2]<<company3[3]<<endl;
- cout<<left<<setw(20)<<company4[0]<<setw(20)<<company4[1]<<setw(20)<<company4[2]<<company4[3]<<endl;
- cout<<left<<setw(20)<<company5[0]<<setw(20)<<company5[1]<<setw(20)<<company5[2]<<company5[3]<<endl;
- cout<<left<<setw(20)<<company6[0]<<setw(20)<<company6[1]<<setw(20)<<company6[2]<<company6[3]<<endl;
- cout<<left<<setw(20)<<company7[0]<<setw(20)<<company7[1]<<setw(20)<<company7[2]<<company7[3]<<endl;
- cout<<left<<setw(20)<<company8[0]<<setw(20)<<company8[1]<<setw(20)<<company8[2]<<company8[3]<<endl;
- cout<<left<<setw(20)<<company9[0]<<setw(20)<<company9[1]<<setw(20)<<company9[2]<<company9[3]<<endl;
- cout<<"\nInformation from New York"<<endl;
- string allCompanys[]{company1[0],company2[0],company3[0],company4[0],company5[0],company6[0],company7[0],company8[0],company9[0]};
- string allAddresses[]{company1[1],company2[1],company3[1],company4[1],company5[1],company6[1],company7[1],company8[1],company9[1]};
- string allCitys[]{company1[2],company2[2],company3[2],company4[2],company5[2],company6[2],company7[2],company8[2],company9[2]};
- string allStates[]{company1[3],company2[3],company3[3],company4[3],company5[3],company6[3],company7[3],company8[3],company9[3]};
- cout<<left<<setw(20)<<"Name"<<setw(20)<<"Address"<<setw(20)<<"City"<<"State"<<endl;
- for(int c=0;c<9;c++)if(allCitys[c]=="New York")cout<<left<<setw(20)<<allCompanys[c]<<setw(20)<<allAddresses[c]<<setw(20)<<allCitys[c]<<allStates[c]<<endl;
- string hold="";
- string allString[]={"Bantam Books","ETN Corporation","Benajmin/Cummings","Intertext","Addison Wesley","Brady Pub","Gale","ACM","Keegan Tech",};
- cout<<"\nNames in Alphabetical Order"<<endl;
- for(int c=0;c<9;c++)
- {
- for(int x=0;x<9;x++)if(allString[x]>allString[x+1])
- {
- hold=allString[x];
- allString[x]=allString[x+1];
- allString[x+1]=hold;
- }
- }
- for(int c=0;c<9;c++)cout<<allString[c]<<", ";
- cout<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment