fork download
  1. //Xinnuo Wang CS1A chapter 2, p.81 #2
  2. //
  3. /*******************************************************************************
  4.  *
  5.  * Sales Prediction
  6.  * _____________________________________________________________________________
  7.  * This program computes the prediction how much the East Coast division will
  8.  * generate if the company has $4.6 million in sales this year based on the East
  9.  * Coast sales division of a company generates 62 percent of total sales.
  10.  *
  11.  * Computation is based on the formula:
  12.  * East Coast sales = total sales * percentage
  13.  * _____________________________________________________________________________
  14.  * INPUT
  15.  * total sales : The total sales of the company this year
  16.  * percentage : The persentage of the East Coast divition on total sales
  17.  * OUTPUT
  18.  * East Coast sales: The prediction of East Coast sales
  19.  *
  20.  ******************************************************************************/
  21. #include <iostream>
  22. using namespace std;
  23.  
  24. int main()
  25. {
  26. float totalSales; //INPUT - The total sales of the company this year
  27. float percentage; //INPUT - The persentage of the East Coast divition on total sales
  28. float EastCoastSales; //OUTPUT - The prediction of East Coast sales
  29. //
  30. // Initialize Program Variables
  31. totalSales = 4.60;
  32. percentage = 0.62;
  33. //
  34. // compute the pridiction of the East Coast sales
  35. EastCoastSales = totalSales * percentage;
  36. //
  37. // Output Result
  38. cout << "The prediction of the East Coast sales is: $" << EastCoastSales<< "millon" <<endl;
  39. return 0;
  40. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
The prediction of the East Coast sales is: $2.852millon