Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3. #include <cstring>
  4. #include "stdio.h"
  5. #include <conio.h>
  6.  
  7. using namespace std;
  8. class tekst {
  9. char *p;
  10. public:
  11. tekst() {
  12. p = new char[1];
  13. }
  14. void assign(char *t) {
  15. strcpy(p, t);
  16. }
  17. tekst(char *t) {
  18. p = t;
  19. }
  20. void operator+(tekst const &a) {
  21. strcat(this->p, a.p);
  22. }
  23. void operator=(tekst a) {
  24. strcpy(p, a.p);
  25. }
  26. void print() {
  27. cout << p << endl; //użyć printf bo cout ssie
  28. }
  29. void operator!() {
  30. cout << this->p << endl; //tu to samo
  31. }
  32.  
  33. };
  34.  
  35. int main()
  36. {
  37. tekst a, b, c;
  38. b.assign("Tekscior"); //tu może wywali błąd ale podobno jest ładnie więc co sie bede kłócił
  39. b.print();
  40. a = b;
  41. !a;
  42. _getch();
  43. a.assign("Tekst");
  44. !b; !a;
  45. c=a+b;
  46. !c;
  47.  
  48. _getch();
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement