Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <iostream>
  7.  
  8. class student
  9. {
  10. char name[10];
  11. char f_name[30];
  12. long number;
  13. public:
  14. void set_name(char *p);
  15. void set_f_name(char *q);
  16. void set_number(long n);
  17. void print(void);
  18. };
  19.  
  20. void student::set_name(char *p)
  21. {
  22. strcpy_s(name, p);
  23. // p = name;
  24.  
  25. }
  26. void student::set_f_name(char *q)
  27. {
  28. strcpy(f_name, q);
  29. // q = f_name;
  30.  
  31. }
  32.  
  33. void student::set_number(long n)
  34. {
  35. number = n;
  36. }
  37. void student::print(void)
  38. {
  39. // std::cout << name << std::endl;
  40. // std::cout << f_name << std::endl;
  41. // std::cout << number << std::endl; <-konczy linie
  42.  
  43. printf("%s\n", name);
  44. printf("%s\n", f_name);
  45. printf("%d\n\n", number);
  46.  
  47. }
  48.  
  49.  
  50. void main(void){
  51. student a;
  52. a.set_name("Krystian");
  53. a.set_f_name("Lenc");
  54. a.set_number(223561);
  55. a.print();
  56.  
  57. //student b;
  58. //b = a;
  59. // b.print();
  60. _getch();
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement