KeeganT

Ass67

Oct 15th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.07 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string company1[]{"Bantam Books","666 Fifth Ave","New York","NY"};
  9.     string company2[]{"ETN Corporation","Rd 4, Box 659","Detroit","MI"};
  10.     string company3[]{"Benjamin/Cummings","390 Bridge Pkwy","Redwood","CA"};
  11.     string company4[]{"Intertext","2633 E.17th Ave","New York","NY"};
  12.     string company5[]{"Addison Wesley","Rte 128","Reading","MA"};
  13.     string company6[]{"Brady Pub","15 Columbus Cir","New York","NY"};
  14.     string company7[]{"Gale","835 Penobscot","Redwood","CA"};
  15.     string company8[]{"ACM","11W. 42nd St.","New York","NY"};
  16.     string company9[]{"Keegan Tech","63 Hillside Ave","Hamilton","ON",};
  17.     cout<<"All Information"<<endl;
  18.     cout<<left<<setw(20)<<"Name"<<setw(20)<<"Address"<<setw(20)<<"City"<<"State"<<endl;
  19.     cout<<left<<setw(20)<<company1[0]<<setw(20)<<company1[1]<<setw(20)<<company1[2]<<company1[3]<<endl;
  20.     cout<<left<<setw(20)<<company2[0]<<setw(20)<<company2[1]<<setw(20)<<company2[2]<<company2[3]<<endl;
  21.     cout<<left<<setw(20)<<company3[0]<<setw(20)<<company3[1]<<setw(20)<<company3[2]<<company3[3]<<endl;
  22.     cout<<left<<setw(20)<<company4[0]<<setw(20)<<company4[1]<<setw(20)<<company4[2]<<company4[3]<<endl;
  23.     cout<<left<<setw(20)<<company5[0]<<setw(20)<<company5[1]<<setw(20)<<company5[2]<<company5[3]<<endl;
  24.     cout<<left<<setw(20)<<company6[0]<<setw(20)<<company6[1]<<setw(20)<<company6[2]<<company6[3]<<endl;
  25.     cout<<left<<setw(20)<<company7[0]<<setw(20)<<company7[1]<<setw(20)<<company7[2]<<company7[3]<<endl;
  26.     cout<<left<<setw(20)<<company8[0]<<setw(20)<<company8[1]<<setw(20)<<company8[2]<<company8[3]<<endl;
  27.     cout<<left<<setw(20)<<company9[0]<<setw(20)<<company9[1]<<setw(20)<<company9[2]<<company9[3]<<endl;
  28.     cout<<"\nInformation from New York"<<endl;
  29.     string allCompanys[]{company1[0],company2[0],company3[0],company4[0],company5[0],company6[0],company7[0],company8[0],company9[0]};
  30.     string allAddresses[]{company1[1],company2[1],company3[1],company4[1],company5[1],company6[1],company7[1],company8[1],company9[1]};
  31.     string allCitys[]{company1[2],company2[2],company3[2],company4[2],company5[2],company6[2],company7[2],company8[2],company9[2]};
  32.     string allStates[]{company1[3],company2[3],company3[3],company4[3],company5[3],company6[3],company7[3],company8[3],company9[3]};
  33.     cout<<left<<setw(20)<<"Name"<<setw(20)<<"Address"<<setw(20)<<"City"<<"State"<<endl;
  34.     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;
  35.     string hold="";
  36.     string allString[]={"Bantam Books","ETN Corporation","Benajmin/Cummings","Intertext","Addison Wesley","Brady Pub","Gale","ACM","Keegan Tech",};
  37.     cout<<"\nNames in Alphabetical Order"<<endl;
  38.     for(int c=0;c<9;c++)
  39.     {
  40.         for(int x=0;x<9;x++)if(allString[x]>allString[x+1])
  41.         {
  42.             hold=allString[x];
  43.             allString[x]=allString[x+1];
  44.             allString[x+1]=hold;
  45.         }
  46.     }
  47.     for(int c=0;c<9;c++)cout<<allString[c]<<", ";
  48.     cout<<endl;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment