Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <assert.h>
- using namespace std;
- struct Time
- {
- int s;
- int m;
- int h;
- };
- void time_modifier(Time *ptr);
- void arr_dyn();
- void main()
- {
- //int time;
- Time test;
- time_modifier(&test);
- }
- void time_modifier(Time *ptr)
- {
- /*ptr->s = 70;
- ptr->m = 128;
- ptr->h = 3;*/
- int sec, min, hour;
- cout << "please enter values:" << endl;
- cout << "hour,min,sec format:" << endl;
- cin >> ptr->h >> ptr->m >> ptr->s;
- int new_s =(ptr->s) / 60; //(70/60) == 1
- int new_m = (ptr->m) / 60; // (128/60) == 2
- ptr->s = (ptr->s) % 60; // 70%60==10
- ptr->m = ((ptr->m) + (new_s)) % 60; // (128 +1) % 60 == 9 True result
- ptr->h = ((ptr->h) + (new_m)); // 3+2 == 5 True result
- cout << "results:" << endl;
- cout << ptr->h << ":" << ptr->m << ":" << ptr->s;
- }
- void arr_dyn()
- {
- int n;
- int *p;
- cout << "Enter how many values:" << endl;
- cin >> n;
- p = new p[n];
- // not yet to be done.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement