Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include<iostream>
  2. #include<conio.h>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. float compute(float start, int duration){
  7. int ora_h = 0;
  8. ora_h = floor(start); //Cel mai mare intreg mai mic decat numarul
  9.  
  10.  
  11. float minutesLeft = start - ora_h;
  12.  
  13.  
  14. cout<<endl<<minutesLeft<<endl;
  15.  
  16.  
  17. minutesLeft *= 100;
  18.  
  19. minutesLeft += duration;
  20.  
  21. int plus_h;
  22.  
  23. plus_h= floor(minutesLeft / 60);
  24.  
  25. minutesLeft=minutesLeft-plus_h*60;
  26.  
  27. ora_h=ora_h+plus_h;
  28.  
  29.  
  30. cout<<endl<<ora_h<<endl;
  31. cout<<endl<<minutesLeft<<endl;
  32. getch();
  33.  
  34. minutesLeft = int(ceil(minutesLeft)) % 60;
  35. minutesLeft /= 100;
  36. ora_h += minutesLeft;
  37. return ora_h;
  38. }
  39.  
  40. int main()
  41. {
  42. // cout<<
  43. compute(8.50,69);
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement