Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. Student(char *_last_name = "Smith", char *_first_name = "John",
  2. char *_patronymic = "", short int _birth_day = 17,
  3. short int _birth_month = 4, int _birth_year = 1997,
  4. char *_address = "Moscow", char *_phone_num = "1231212",
  5. char *_faculty = "IU", short int _year_of_study = 2) :
  6. birth_day(_birth_day),
  7. birth_month(_birth_month), birth_year(_birth_year),
  8. year_of_study(_year_of_study) {
  9. last_name = (char*)calloc(strlen(_last_name) + 1, sizeof(char));
  10. first_name = (char*)calloc(strlen(_first_name) + 1, sizeof(char));
  11. patronymic = (char*)calloc(strlen(_patronymic) + 1, sizeof(char));
  12. address = (char*)calloc(strlen(_address) + 1, sizeof(char));
  13. phone_num = (char*)calloc(strlen(_phone_num) + 1, sizeof(char));
  14. faculty = (char*)calloc(strlen(_faculty) + 1, sizeof(char));
  15. strcpy(last_name, _last_name);
  16. strcpy(first_name, _first_name);
  17. strcpy(patronymic, _patronymic);
  18. strcpy(address, _address);
  19. strcpy(phone_num, _phone_num);
  20. strcpy(faculty, _faculty);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement