fork download
  1. //Zachary Abdollahi CS1A Chapter 2, P. 83, #12
  2. //
  3. /*******************************************************************************
  4.  *
  5.  * COMPUTE LAND ACREAGE
  6.  *______________________________________________________________________________
  7.  * This program calculates the number of acres in a tract of land
  8.  * given its size in square feet.
  9.  *
  10.  * Computation is based on the formula:
  11.  * Acres = Total Square Feet / Square Feet per Acre
  12.  *______________________________________________________________________________
  13.  * INPUT
  14.  * sqFeetPerAcre : Number of square feet in one acre (43,560)
  15.  * tractSqFeet : Total square feet of the land tract (389,767)
  16.  *
  17.  * OUTPUT
  18.  * acres : Calculated number of acres
  19.  *
  20.  ******************************************************************************/
  21. #include <iostream>
  22. #include <iomanip>
  23. using namespace std;
  24.  
  25. int main()
  26. {
  27. float sqFeetPerAcre; //INPUT - Square feet per acre
  28. float tractSqFeet; //INPUT - Total square feet of tract
  29. float acres; //OUTPUT - Calculated number of acres
  30.  
  31. // Initialize Program Variables
  32. sqFeetPerAcre = 43560.0;
  33. tractSqFeet = 389767.0;
  34.  
  35. // Compute Acres
  36. acres = tractSqFeet / sqFeetPerAcre;
  37.  
  38. // Output Result
  39. cout << fixed << setprecision(2);
  40. cout << "A tract of " << tractSqFeet << " sq ft is equal to ";
  41. cout << acres << " acres." << endl;
  42.  
  43. return 0;
  44. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
A tract of 389767.00 sq ft is equal to 8.95 acres.