avr39ripe

cppCallCost

Jun 17th, 2021 (edited)
602
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5.     const int kopInGrn{ 100 };
  6.     const int secInMin{ 60 };
  7.  
  8.     double minuteCostGrn{1};
  9.     int callTimeMin{ 1 };
  10.     int callTimeSec{ 30 };
  11.    
  12.     std::cout << "Enter call cost per minute in Grn\n";
  13.     std::cin >> minuteCostGrn;
  14.  
  15.     std::cout << "Enter call duration, minutes\n";
  16.     std::cin >> callTimeMin;
  17.  
  18.     std::cout << "Enter call duration, seconds\n";
  19.     std::cin >> callTimeSec;
  20.  
  21.     double callCostTotal = (callTimeMin + callTimeSec / (double)secInMin) * minuteCostGrn;
  22.    
  23.     std::cout << "Total call cost: " << (int)callCostTotal << " grn. " << (int)(callCostTotal * kopInGrn) % kopInGrn << " kop\n";
  24. }
RAW Paste Data