C++ Arithmetic Operator Calculating the number of pools

Description

C++ Arithmetic Operator Calculating the number of pools

#include <iostream>

int main() {/*from   w w  w.j  av  a  2s .co  m*/
  const int inches_per_foot {12};

  double shelf_length {};
  double shelf_depth {};
  double pool_size {};

  std::cout << "Enter length (feet): ";
  std::cin >> shelf_length;

  std::cout << "Enter depth (feet): ";
  std::cin >> shelf_depth;

  std::cout << "Enter length of the side of a pool (inches): ";
  std::cin >> pool_size;

  long pools {static_cast<long>((shelf_length * inches_per_foot) / pool_size) * static_cast<long>((shelf_depth * inches_per_foot) / pool_size)};

  std::cout << "The number of pools that can be contained in a single layer is " << pools << std::endl;
}



PreviousNext

Related