Community Sites
Create your own community website and start earning today !
It's Free !
 
Communities Members BookmarksPolls Fresher Jobs Strange Photos Academic Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter




C++ PROGRAM FOR COMPARISION OF STRING USING OPERATOR OVERLOADING


Posted Date: 16 Mar 2008    Resource Type: Articles/Knowledge Sharing    Category: Computer & Technology

Posted By: ashish singh       Member Level: Diamond
Rating:     Points: 2



PROGRAM FOR COMPARISION OF STRING USING OPERATOR OVERLOADING

//comparision of string
#include
#include
const int SIZE=50;
enum boolean{FALSE,TRUE};
class string
{
public:
char str[SIZE];

string()
{
strcpy(str,””);
}
void read()
{
cin>>str;
}
void echo()
{
cout< }
boolean operator <(string s)
{
if (strcmp(str,s.str)<0)
return TRUE;
else
return FALSE;
}
boolean operator >(string s)
{
if (strcmp(str,s.str)>0)
return TRUE;
else
return FALSE;
}
boolean operator <(char *mystr)
{
if (strcmp(str,mystr)==0)
return TRUE;
else
return FALSE;
}
};


void main()
{
string str1,str2;

{

cout<<”enter string1:”;
str1.read();
cout<<”enter string2:”;
str2.read();
cout<<”comparison status:”;
str1.echo();
if(str1 cout<<”<”;
else if(str1>str2)
cout<<”>”;
else
cout<<”=”;
str2.echo();
cout< }
}

Output:

enter string1:ashish
enter string2:ashish++
comparision status:ashishPress any key to continue




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: C++ FOR SUM THROUGH OVER LOADED FUNCTION
Previous Resource: C++ PROGRAM FOR SHOWING OPERATOR OVERLOADING ++ AND –-
Return to Discussion Resource Index
Post New Resource
Category: Computer & Technology


Post resources and earn money!
 
Related Resources

Watch TV Channels



Contact Us    Editors    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.