fork download
  1. //Charlotte Davies-Kiernan CS1A Chapter 2, P. 83, #12
  2. //
  3. /*****************************************************************************
  4.  *
  5.  * Compute Land Calculation
  6.  * ___________________________________________________________________________
  7.  * This program computes the number of acres in a tract of land.
  8.  *
  9.  * Computation is based on the formula:
  10.  * Number of Acres = Total Square Feet / Square Feet per Acre
  11.  * ___________________________________________________________________________
  12.  * INPUT
  13.  * square_feet_per_acre : Constant for square in one acre
  14.  * totalSquareFeet : Total square feet in a tract of land
  15.  *
  16.  * OUTPUT
  17.  * acres : Number of acres in a tract of land
  18.  *
  19.  ****************************************************************************/
  20. #include <iostream>
  21. #include <iomanip>
  22. using namespace std;
  23. int main()
  24. {
  25. float square_feet_per_acre; //INPUT - Constant for square in one acre
  26. float totalSquareFeet; //INPUT - Total square feet in a tract of land
  27. float acres; //OUTPUT - Number of acres in a tract of land
  28. //
  29. // Initialize Program Variables
  30. square_feet_per_acre = 43560.0;
  31. totalSquareFeet = 389767.0;
  32. //
  33. // Compute the number of acres
  34. acres = totalSquareFeet / square_feet_per_acre;
  35. //
  36. // Output Result
  37. cout << "The land with " << totalSquareFeet << " square feet is ";
  38. cout << "approximately " << acres << " acres." << endl;
  39.  
  40. return 0;
  41. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
The land with 389767 square feet is approximately 8.94782 acres.