السلام عليكم ....
شباب عمجرب هالكود بال ++C و عميطلعلي فيو خطأ حدا بيحسن يساعدني ?!!!!
#include <iostream>
#include <string>
using namespace std;
const int size =80;
enum boolean {true,false};
class string
{
private:
char str[size];
public:
string()
{
strcpy(str," ");}
string(char s[])
{
strcpy(str,s);}
void disblay()
{
cout<<str;}
void getstr()
{
cin.getline(str,size);}
boolean operator ==(string ss)
{
return (strcmp(str,ss.str)==0)?true : false;
}
string operator+(string ss)
{
if(strlen(str)+strlen(ss.str)<size)
{
string temp;
strcpy(temp.str,ss.str);
strcat(temp.str,ss.str);
return temp;
}
else
cout<<"string is too long \n";
return 0;
}
};
int main ()
{
string s1="Welcome";
string s2="to c++";
string s3;
s3.disblay();
s1="yes";
s2="No";
cout<< "\nenter A string :";
s2.getstring();
if(s3==s1)
cout<<"S3=S1";
else
if(s3==s2)
cout<<"S3=S2";
else
cout<<"\nExiting";
return 0;
}و شكراً سلفا :)
