Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include "String.h"
- using namespace std;
- String::String()
- {
- length = 80;
- str = new char[length+1];
- str[0] = 0;
- }
- String::String(int aLength)
- {
- str = new char[aLength+1];
- str[0] = 0;
- }
- String::String(char *aStr)
- {
- length = strlen(aStr);
- str = new char[length+1];
- strcpy(str, aStr);
- }
- String::~String()
- {
- delete[] str;
- }
- void String::Print()
- {
- cout << "\t" << str << "\n";
- }
- void String::Read()
- {
- gets(str);
- length = strlen(str);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement