Alisha Naaz http://vualisha.blogspot.com E-mail: vualisha@gmail.com

......Indian Songs.......

>

Wednesday, February 10, 2010

CS 201 Ass Solution

#include
#include
#include
// class definition
class String
{
private:
char*buf;
public:
//constractors
String();
String(const char*s)
{
buf=new char[30];
strcpy(buf,s);
}
// display
void display()
{
cout< }
int length()const
{
return strlen(buf);
}
void operator=(const String &other);
};
void String::operator=(const String &other)
{
int length;
length=other.length();
delete buf;
buf=new char [length+1];
strcpy(buf,other.buf);
}
main()
{
String myString("=s2");
cout<<"s1+";
myString.display();
cout<<"\n";
String yourString("s3=");
cout<<"\n";
yourString=myString;
cout<<"s3=s1+";
yourString.display();
cout<<"\n";
system("pause");
}

0 comments:

Searching Video

Vu Alisha Search

VUalisha Followers (Jion Now and Get Extra benefits)

Contact Us

My photo
E-mail: vualisha@gmail.com