דגגדגדגדגד
#include <iostream> #include <string.h> using namespace std; class Word { private : char * word; char * trans; char * example; public : Word():word(new char[20]),trans(new char[20]),example(new char[80]) {} char* getword() { return word;} char* getrans() { return word;} char* getexample() { return example;} int setword(const char * w) { word=strcpy(word,w); return 1; } int settrans(const char * w) { trans=strcpy(word,w); return 1; } int setexample(const char * w) { example=strcpy(word,w); return 1; } }; bool wordcompare(const Word& w1,const Word& w2) { if ((strcmp(w1.getword(),w2.getword())==0) && (strcmp(w1.getword(),w2.getword())==0) && (strcmp(w1.getword(),w2.getword())==0)) return true; return false; } int main() { Word w1; Word w2; int a; w1.setword("bob"); w2.setword("bob"); cout<<wordcompare(w1,w2)<<endl; cin >> a; return 1; }