Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- ////////////////////////////////////////
- struct T
- {
- static int nCounter;
- int nSec;
- int nMin;
- char szName[77];
- void get(int n);
- void monitor();
- T()
- {
- nCounter ++;
- nSec = 20;
- nMin = 10;
- strcpy(szName, "noname");
- }
- };
- int T::nCounter = 0;
- void monitor(T *p);
- /////////////////////////////////////////////////////////////////////
- int main() //
- {
- T t_1, t_2;
- t_1.get(712);
- t_2.monitor();
- printf("&t_2 = %d\n", &t_2);
- printf("t_1.nCounter = %d\n", t_1.nCounter);
- printf("t_2.nCounter = %d\n", t_2.nCounter);
- printf("sizeof(t_1) = %d\n", sizeof(t_1));
- printf("address of t_2.nSec = %d\n", &t_2.nSec);
- }
- //////////////////////////////////////////////////////////////////////
- void T::monitor()
- {
- printf("Minuts = %d\n", this -> nMin);
- printf("Seconds = %d\n", this -> nSec);
- printf("szName = %s\n", this -> szName);
- printf("this = %d\n", this);
- }
- ////////////////////////////////////////////
- void T::get(int n)
- {
- nMin = n / 60;
- nSec = n % 60;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement