Recent Posts
None | 13 sec ago
None | 22 sec ago
None | 27 sec ago
None | 46 sec ago
None | 48 sec ago
None | 49 sec ago
None | 52 sec ago
None | 1 min ago
C++ | 1 min ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By anonforuz on the 9th of Feb 2010 07:25:46 PM Download | Raw | Embed | Report
  1. //courseID:CIS265001
  2. //name: Tedeschi, Christopher
  3. //Prof. Wang
  4. //Project???????????????3
  5. //Due by ________________?
  6.  
  7. /*
  8.   Programming Challenge #12 pg 152
  9.  
  10.   task:
  11.  
  12.   steps:
  13. */
  14.  
  15.  
  16. #include <iomanip>
  17. #include <iostream>
  18. using namespace std;
  19.  
  20. int main()
  21. {
  22.     double sales[4],
  23.            salesCopy;
  24.     int x,
  25.         y,
  26.         z;
  27.    
  28.     char companiesCopy[10],
  29.          companies[4][10]={"Northeast",
  30.                                    "Southeast",
  31.                                    "Northwest",
  32.                                    "Southwest"};
  33.                                    
  34.                                    
  35.     //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   first fucntion                     
  36.     cout << "Please enter the quarterly sales for each region" << endl;
  37.         for(x=0;x<=3;x++)
  38.         {
  39.              cout << companies[x]<< ": ";
  40.              cin  >> sales[x];
  41.  
  42.              while (sales[x] < 0)             //negative check
  43.              {
  44.               cout << "Please enter non-negative value." << endl;
  45.               cout << companies[x];
  46.                   cin  >> sales[x];
  47.          }
  48.          cout << "------------------" << endl;
  49.          cout << companies[x] << ": "<< setprecision(2) << sales[x] << endl;
  50.          system("CLS");
  51.         }
  52.         for(x=0;x<=3;x++)
  53.         {
  54.          cout << companies[x] << ": "<< setprecision(2) << sales[x] << endl;
  55.     }
  56.     //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx second fucntion
  57.     while(y!=0)   //Orders The Sales Items of Copied Arrays from Greatest to Least
  58.     {
  59.          for(x=0;x<=2;x++)
  60.          {
  61.                   if( sales[x] < sales[x+1] )
  62.                   {
  63.                        y=1;
  64.                        salesCopy = sales[x];
  65.                        sales[x] = sales[x+1];
  66.                        sales[x+1] = salesCopy;
  67.    
  68.                    for(z=0;z<=10;z++) // makes copy of original
  69.                    {
  70.                         companiesCopy[z]=companies[x][z];
  71.                    }
  72.                    for(z=0;z<=10;z++) // copies one element to another
  73.                    {
  74.                         companies[x][z]=companies[x+1][z];
  75.                    }
  76.                    for(z=0;z<=10;z++) //  copies the copy into original array
  77.                    {
  78.                         companies[x+1][z]=companiesCopy[z];
  79.                    }
  80.               }
  81.              }
  82.     }
  83.     //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   rest of the out put that could be in the main
  84.     cout << endl;
  85.     cout << "Most Sold Product(s)" << endl;
  86.     cout << "-----------------------------" << endl;
  87.     cout << companies[0] << ": "<< setprecision(2) << sales[0] << endl;
  88.  
  89.  
  90.     for(x=1;x<=3;x++) // Lists Products that Sold Equally Well
  91.     {
  92.              if(sales[0]==sales[x])
  93.              {
  94.               cout << companies[x] << ": "<< setprecision(2) << sales[x] << endl;              
  95.              }
  96.     }
  97.     //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx          
  98.    
  99.     system ("pause");
  100.     return 0;
  101.  
  102. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: