Advertisement
alkelane7

Struct

Mar 16th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. Ahmed Sami:
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6. struct time{
  7.  
  8. int year[2],month[2],day[2];
  9.  
  10. int mins[2];
  11. int clk[2];
  12.  
  13.  
  14.  
  15.  
  16. };
  17.  
  18. void dt(){
  19.  
  20. struct time t;
  21.  
  22. for(int i=0;i<2;i++){
  23.  
  24. cout<<"Entre date year/month/day : ";
  25. cin>>t.year[i]>>t.month[i]>>t.day[i];
  26. cout<<"\n Entre time o'clock : minutes ";
  27. cin>>t.clk[i];
  28. cout<<" : ";
  29. cin>>t.mins[i];
  30.  
  31.  
  32.  
  33.  
  34. }
  35.  
  36.  
  37.  
  38. int dif;
  39. dif = t.mins[0] - t.mins[1];
  40.  
  41. cout<<"\n the diffrence between these two times : "<<dif<<" minuites"<<endl;
  42.  
  43.  
  44.  
  45.  
  46.  
  47. }
  48.  
  49. int main()
  50. {
  51.  
  52. dt();
  53.  
  54.  
  55. return 0;
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement