Advertisement
Infernale

NCTU LAB 17/10 NUM 1

Oct 17th, 2019
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. namespace box{
  6.   float side1, side2, side3;
  7.   void calculateVolume(){
  8.     cout << setw(15) << setprecision(5) << fixed << side1*side2*side3 << endl;
  9.   }
  10. }
  11.  
  12. namespace{
  13.   void maxSide(){
  14.     cout << setw(15) << setprecision(5) << max(box::side1, max(box::side2, box::side3)) << endl;
  15.   }
  16.   void minSide(){
  17.     cout << setw(15) << setprecision(5) << min(box::side1, min(box::side2, box::side3)) << endl;
  18.   }
  19. }
  20.  
  21. int main(){
  22.   while(1){
  23.     cin >> box::side1 >> box::side2 >> box::side3;
  24.     box::calculateVolume();
  25.     maxSide();
  26.     minSide();
  27.   }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement