string issue in c++

"joni194" <[email protected]> Mon, 03 Dec 2007 04:09:51 -0000
Newsgroups gmane.comp.programming.cppug
Message-ID <[email protected]>
I have problem in this program:
---------------------------------------------------------------------
class sets{
private:
	string A[500], B[500];
	int lenA,lenB;
public:
	//-------------inout output of set A-----------
      void getA(){
	  cout<<"Enter elements of A"<<endl;
	  lenA=1;
      do{getline(cin,A[lenA]);lenA++;}
      while(A[lenA-1]!="}" && A[lenA-1]!=")" && A[lenA-1]!="]" && 
lenA<=499);
      lenA--;}

     void showA(){
	  cout<<"A = ";
	  for(int i=0; i<=lenA;i++)cout<<A[i]<<"  ";}
    //---------------input output of set B---------------
    void getB(){
	  cout<<"Enter elements of B"<<endl;
	  lenB=1;
      do{getline(cin,B[lenB]);lenB++;}
      while(B[lenB-1]!="}" && B[lenB-1]!=")" && B[lenB-1]!="]" && 
lenB<=499);
	lenB--;}

	void showB(){
	  cout<<"B = ";
	  for(int i=0; i<=lenB;i++)
	     cout<<B[i]<<"  ";}
  //-----------------Compaison of two sets--------------------
      void Compare(){
	int i=0;bool s=1;
	if(lenA>lenB){s=0;}
	else
	   while(i<=lenA && s==1){
                cout<<A[i]<<" f"<<B[i+1]<<"f"<<endl;
	        if(A[i]!=B[i]){s=0;break;}i++;}


	if(s==1)
	    cout<<"A is SubSet of B"<<endl;
	else if(s==0)
	    cout<<"A is not sub set of Bg"<<endl;}


	void l(){
	  cout<<endl<<"A: "<<lenA<<"   "<<"B: "<<lenB<<endl;}
};

void main(){
  
  sets a;
  a.getA();
  a.getB();

  a.showA();
  a.showB();
  cout<<endl;

  a.Compare();
  a.l();
}
---------------------------------------------------------------------
i written program to check two sets if set A is sub set of set B or 
not.

But in program there is an issue that getA() and getB() functions 
are 100% same but behave different.i have checked in Visual C++;



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/cppug/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/cppug/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/