first commit
This commit is contained in:
72
Lab6/str.cpp
Normal file
72
Lab6/str.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
#include <iostream.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "Str.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Str::Str():curPos(0){
|
||||
|
||||
str = new char[200];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Str::Str(char* _str){
|
||||
|
||||
str = new char[200];
|
||||
|
||||
strcpy(str, _str);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Str::~Str(){
|
||||
|
||||
delete [] str;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool Str::operator==(Str &src){
|
||||
|
||||
if(strcmp(src.getStr(), getStr()) == 0)
|
||||
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Str::Str(const Str& src)
|
||||
|
||||
{
|
||||
|
||||
str = new char [strlen(src.str)+1] ;
|
||||
|
||||
strcpy(str,src.str);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Str& Str::operator =(const Str &src){
|
||||
|
||||
Reference in New Issue
Block a user