Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <iostream>
- using namespace std;
- /////////////////////////////////////////////////////////////
- struct YY
- {
- int nOld;
- char szName [99];
- char szLastName[99];
- int nNumbSv;
- ////////////
- void init(const char *p1, const char *p2);
- };
- extern int n;
- ////////////////////////////////////////////////////////////
- int www()
- {
- return n;
- }
- YY yDima;
- int n = 9111;
- /////////////////////////////////////////////////////////////
- int main()
- {
- yDima.nOld = 51;
- strcpy(yDima. szName, "Dima" );
- strcpy(yDima.szLastName, "Sobolev");
- cout << "www() = "<< www() << endl;
- cout << "yDima. szName = " << yDima. szName << endl;
- cout << "yDima.szLastName = " << yDima.szLastName << endl;
- yDima.init("Oleg", "Ivanov");
- cout << "yDima. szName = " << yDima. szName << endl;
- cout << "yDima.szLastName = " << yDima.szLastName << endl;
- return 0;
- }
- ////////////////////////////////////////
- void YY::init(const char *p1, const char *p2)
- {
- strcpy(szName , p1);
- strcpy(szLastName, p2);
- }
- /*
- #include <string.h>
- #include <iostream>
- using namespace std;
- /////////////////////////////////////////////////////////////
- struct YY
- {
- int nOld;
- char szName [99];
- char szLastName[99];
- int nNumbSv;
- ////////////
- void init(const char *p1, const char *p2)
- {
- strcpy(szName , p1);
- strcpy(szLastName, p2);
- }
- };
- extern int n;
- ////////////////////////////////////////////////////////////
- int www()
- {
- return n;
- }
- YY yDima;
- /////////////////////////////////////////////////////////////
- int main()
- {
- yDima.nOld = 51;
- strcpy(yDima. szName, "Dima" );
- strcpy(yDima.szLastName, "Sobolev");
- cout << "www() = "<< www() << endl;
- cout << "yDima. szName = " << yDima. szName << endl;
- cout << "yDima.szLastName = " << yDima.szLastName << endl;
- yDima.init("Oleg", "Ivanov");
- cout << "yDima. szName = " << yDima. szName << endl;
- cout << "yDima.szLastName = " << yDima.szLastName << endl;
- return 0;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement