Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #include<iostream>
  2. #include<conio.h>
  3. #include <cmath>
  4. using namespace std;
  5. int n; // numarul spectacolelor !
  6. float O[100][3];
  7.  
  8. float compute(float start, int duration)
  9. { int ora_h = 0;
  10. ora_h = floor(start);
  11. float minutesLeft = start - ora_h;
  12. minutesLeft *= 100;
  13. minutesLeft += duration;
  14. int plus_h;
  15. plus_h= floor(minutesLeft / 60);
  16. minutesLeft=minutesLeft-plus_h*60;
  17. ora_h=ora_h+plus_h;
  18. minutesLeft = int(ceil(minutesLeft)) % 60;
  19. minutesLeft /= 100;
  20. ora_h += minutesLeft;
  21. return ora_h; }
  22.  
  23. int read_data()
  24. {
  25. fstream f;
  26. f.open("intput.dat",ios::in);
  27. f>>n;
  28. for(int i=1;i<=n;i++)
  29. {
  30. f>>O[i][1]; // ora de inceput
  31. f>>O[i][2]; // durata
  32. O[i][3]=compute(O[i][1],(intO[i][2])); // ora de sfarsit
  33. }
  34. }
  35.  
  36. int sort_data()
  37. {
  38.  
  39. }
  40.  
  41. int print_data()
  42. {
  43. /*
  44. input.dat
  45.  
  46. 4
  47. 8.10 40
  48. 7.00 20
  49. 11.30 30
  50. 10.45 45
  51.  
  52. de afisat
  53. 7.00 20
  54. 8.10 40
  55. 10.45 45
  56. 11.30 30
  57. */
  58.  
  59. for(int i=1;i<=n;i++)
  60. cout<<O[i][1]<<" "<<O[i][2];
  61.  
  62. }
  63.  
  64. int main()
  65. {
  66. read_data();
  67. print_data();
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement