Total members 10249 | Gratitudes |It is currently Thu May 17, 2012 7:49 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: can u check tis code to perform union & intersection of list
PostPosted: Tue Sep 06, 2011 10:55 am 

Code:
#include<iostream>
using namespace std;
class 
set
{
    
int data[10];
    
int size;
public:
    
set &a(){size=0;}
        
set &b() {size=0;}
     
int getsize() {return size;}
    
void printset()
    {
      
int i;
      for(
i=0;i<size;i++)
      
cout<<data[i]<<endl;
     }    
    
void insertbegning(int data)
    {
      
int i;
      for(
i=size;i>=0;i--)         
      
this->data[i+1]=this->data[i];
     
this-> data[0]=data;
     
size=size+1;
    }
    
void unionof()
    {  
set c;
           
int i,j;
       while(
i!=0||j!=0)
            while(
j!=0)
        {
          if(
i==j)
               
c.insertbegning(data[j]);
              else
                
c.insertbegning(data[i]);
                
c.insertbegning(data[j]);
                        }
}

          
};
        
int main()
    {
       
set a;
       
set b;
           
set c;
           
set d;
       
cout<<a.getsize();
       
cout<<b.getsize(); 
       
a.printset();
       
b.printset();
       
a.insertbegning(40);
       
a.insertbegning(30);
       
a.insertbegning(20);
       
a.insertbegning(10);
       
b.insertbegning(20);
       
b.insertbegning(30);
       
b.insertbegning(50);
       
b.insertbegning(60);
        
cout<<"the content of list a";
           
cout<<"\n";
           
a.printset();
           
cout<<"\n";
       
cout<<"the content of list b";
           
cout<<"\n";
       
b.printset(); 
       
d.unionof();    
       return 
1


TOP
  
Reply with quote  
 Question subject: Re: can u check tis code to perform union & intersection of list
PostPosted: Thu Sep 08, 2011 9:38 pm 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2272
Location: Earth
Has thanked: 39 time
Have thanks: 61 time
what is your problem with this snippet ?

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  

 Similar topics
 Read your gmail using Java code
 Code to open multiple links.
 I need help with checkers code
 java code for listing folder contents from remote folder
 code for online payment system in java
 apriori algorithm java code
 playfair cipher assembly code
 code
 connecting PC with mobile using bluetooth code in java
 code hill cipher C++ Decrypt

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team