FORUMCENTER

SENDE ÜYE OL VE BİZE KATIL BİLGİNİN GÜCÜNE ULAŞ !
 
AnasayfaSSSAramaKayıt OlGiriş yapZiyaretçi Defteri
En son konular
» ForeverAutoHits Türkçe Surf Sitesi / Ödeme Kanıtlı
Salı Ağus. 14, 2018 3:58 pm tarafından metin1

» LotoFun Yatırımsız Sürekli Kazanç
Salı Ağus. 14, 2018 3:56 pm tarafından metin1

» Btcclicks Bitcoin kazandıran Ptc / Ödeme Kanıtlı
Ptsi Kas. 20, 2017 11:10 am tarafından metin1

» Reklam İzleyerek bitcoin kazanma
C.tesi Ağus. 26, 2017 8:56 pm tarafından metin1

» TÜRKİYE CUMHURİYETİ TAPUSU
Perş. Şub. 16, 2017 7:19 am tarafından ORHAN AFACAN

» Bitcofarm ödemeleri
Ptsi Şub. 13, 2017 4:44 pm tarafından metin1

» CetoBeto ödemeleri
Çarş. Kas. 23, 2016 10:51 am tarafından metin1

» Freebitcoin - Faucet game
Salı Kas. 22, 2016 12:13 am tarafından metin1

» Dollarclix payza ödemeleri
Perş. Kas. 17, 2016 1:10 pm tarafından metin1

FORUMCENTER GÜVENLİ İNTERNETİ DESTEKLİYOR
Güvenli İnternet'i Desktekliyoruz
En bakılan konular
Facebook Yorum Attırma HiLesi Yenilenmiştir.
Okul İçin Tavsiyeler
Warcraft 3 + Frozen Throne + Dota (Tek Link Premium Link FuLL SpeeD)
ps2 oyunları indir
TeknoFem Ücretsiz Dersleri
CİLLE 47. BÖLÜM
Facebook Arkadaş Kasma .
Jcow sosyal paylaşım programı
CİLLE`NİN 46. BÖLÜMÜ
okul tavsiyeleri 3 :)
Haftanın en aktif yollayıcıları
Kimler hatta?
Toplam 2 kullanıcı online :: 0 Kayıtlı, 0 Gizli ve 2 Misafir

Yok

Sitede bugüne kadar en çok 706 kişi Perş. Şub. 07, 2013 4:02 pm tarihinde online oldu.
Dost Siteler
Girinti 

Paylaş | 
 

 "C++" HAZIR KODLAR [27]

Aşağa gitmek 
YazarMesaj
afd57
Co-Admin
Co-Admin
avatar

Mesaj Sayısı : 1922
Kayıt tarihi : 11/08/12
Yaş : 22
Nerden : Sinop

MesajKonu: "C++" HAZIR KODLAR [27]   Paz Ağus. 19, 2012 7:30 am

#include
#include
#include
using namespace std;

class Integerset
{
private :
int *set;
int len;
public:
Integerset();
Integerset(int arr[],int x);
~Integerset();
Integerset Unionofsets(Integerset &,Integerset &,Integerset &);
Integerset Intersection(Integerset &,Integerset &,Integerset &);

int memberof(int);
void Insertelem(int,int);

void DeleteElem(int);

int Equal(Integerset &,Integerset &);
void Display();
void operator =(const Integerset &);

};







//////////////////////// D-E-F-A-U-L-T //////////////////////////////
Integerset ::Integerset()
{
len=10;
set=new int[len];
for(int i=0;iset[i]=-1;
}
/////////////// C-O-N-S-T-R-U-C-T-O-R ///////////////////////
Integerset ::Integerset(int arr[],int x)
{
set=new int[x];
len=x;
for(int i=0;iset[i]=arr[i];
}
//////////////// D-E-S-T-R-U-C-T-O-R ///////////////////////
Integerset ::~Integerset()
{

delete[] set;
}
////////////// C-O-P-Y ///////////////
void Integerset erator =(const Integerset & ob)
{
for(int i=0;iset[i]=ob.set[i];
}
////////////////// U-N-I-O-N-S-E-T /////////////////

Integerset Integerset ::Unionofsets(Integerset &obj1,Integerset &obj2,Integerset &obj3)
{



for(int i=0;iobj1.set[i]=obj3.set[i];
int t=0;
int k=obj3.len;

int n=0;

for(i=k;i{
for(int j=0;j{
if(obj2.set[n]!=obj3.set[j])
t=1;
else
{
t=0;
break;
}
}
if(t==1)
{
obj1.set[i]=obj2.set[n];
++n;
}
if(t==0)
{

n++;
}
t=0;
}
return obj1;
}

//////////////// I-N-T-E-R-S-E-C-T-I-O-N //////////////////
Integerset Integerset ::Intersection(Integerset &obj1,Integerset &obj2,Integerset &obj3)
{
for(int i=0;iobj3.set[i]=-1;

int t=0;
int n=0;
for(i=0;i{ t=0;
for(int j=0;j{
if(obj1.set[i]==obj2.set[j])
{ t=1;
break;
}
else
t=0;
}
if(t==1)
{
obj3.set[n]=obj1.set[i];
n++;
}

}
return obj3;
}

/////////////////// D-I-S-P-L-A-Y ///////////////////////////

void Integerset :isplay()
{
cout<<"{";
for(int j=0;j{ if(*(set+j)!=-1)
{ if(*(set+j)!=*(set+(j+1)))
{ if(j+1==len||j+1==Cool
cout<<*(set+j);
else
cout<<*(set+j)<<",";
}
}

}
cout<<"}"<}
/////////////////// M-E-M-B-E-R O-F ///////////////////////
int Integerset ::memberof(int a)
{
int t=0;
for(int i=0;i{ if(set[i]==a)
t=1;
}
if(t==1)
return 1;
else
return 0;
}
/////////////////// I-N-S-E-R-T - E-L-E-M-E-N-T ///////////////////////
void Integerset ::Insertelem(int a,int loc)
{


int t=0;
for(int i=0;i{ if(set[i]==a)
t=1;
}
if(t==1)
cout<<"the number is in the set "<else
{if(loc>len)
cout<<"the location out of size"<else
set[loc]=a;
}

}
/// D-E-L-E-T-E - E-L-E-M-E-N-T ///
void Integerset :eleteElem(int a)
{
int t=0;
for(int i=0;i{ if(set[i]==a)
{
set[i]=-1;
t=1;
}
}
if(t==1)
cout<<" the number "<else
cout<<"the number cannot found in the set"<}


//// E-Q-U-A-L ////
int Integerset::Equal(Integerset & obj1,Integerset& obj2)
{
int t=0;
for(int i=0;i{ for(int j=0;j{ if(obj1.set[i]==obj2.set[j])
{
t=1;
break;
}
else
{
t=0;
}
}
if(t==0)
break;
}
if(t==1)
return 1;
else
return 0;
}

///////////////////////////////////////////////////////////////////////////////////
////////// *** M-A-I-N *** ////////////
///////////////////////////////////////////////////////////////////////////////////
int main()
{

int a[4]={1,2,3},m,k;
int b[4]={7,2,8,6};
int c[5]={3,4,5,6,7};
Integerset s1(a,3);
Integerset s2(b,4);
Integerset s3(c,5);


Integerset s9,s10;
Integerset set1,set2;
Integerset s4,s5,s6;
Integerset s11(a,3),st4,st5,st6;
Integerset s22(b,4);
Integerset s33(c,5);
Integerset s;

///////////// PRINT three SETS //////////////
cout<<" 1-first set : ";
s1.Display();
cout<cout<<" 2-second set : ";
s2.Display();
cout<cout<<" 3-third set : ";
s3.Display();
/////////////////////////////////////////////////////////////////////////////
///////// PRINT UNION of TWO SETS ///////////

//Integerset s4,s5,s6;


cout<<"Enter two set to take union of them "<
cin>>k;
cin>>m;
if(k==1)
{
if(m==2)
{
s5=s1.Unionofsets(s6,s2,s1);
cout<<" unionset of first and second set = ";
s5.Display();cout<}

else if(m==3)
{
s5=s1.Unionofsets(s6,s3,s1);
cout<<" unionset of first and third set = ";
s5.Display();cout<}
}
else if(k==2)
{
if(m==3)
{
s5=s6.Unionofsets(s6,s3,s2);
cout<<" union of second and third set = ";
s5.Display();cout<}
} cout<////////////////////////////////////////////////////////////////////////
////////// PRINT INTERSECTIONSET of TWO SET... ////////////



cout<<" enter two set to take intersection of them ";
cin>>k;
cin>>m;
if(k==1)
{
if(m==2)
{
st4=s11.Intersection(s11,s22,st5);
cout<<" intersectionset of first and second set = ";
st4.Display();cout<}
else if(m==3)
{
st4=s11.Intersection(s11,s33,st5);
cout<<" intersectionset of first and third = ";
st4.Display();cout<}
else if(m==4)
{
st4=s11.Intersection(s11,s5,st5);
cout<<" intersectionset of first and fourth = ";
st4.Display();cout<}
}
else if(k==2)
{
if(m==3)
{
st4=s22.Intersection(s22,s33,st5);
cout<<" intersectionset of second and third = ";
st4.Display();cout<}
else if(m==4)
{
st4=s22.Intersection(s22,s5,st5);
cout<<" intersectionset of second and fourth = ";
st4.Display();cout<}
}
else if(k==3)
{
if(m==4)
{
st4=s33.Intersection(s33,s5,st5);
cout<<" intersectionset of second and third = ";
st4.Display();cout<}
}
////////////////////////////////////////////////////////////////////////
//////// CHECK MEMBER or NOT... //////////// //|

cout<cout<int z,y;
cout<<" enter a number to check it is member of sets or not : ";
cin>>y;
cout<<" which set do you want to check ";
cin>>z;
cout<if(z==1)
{ if(s1.memberof(y))
cout<<" yes "<else
cout<<" No "<cout<}
else if(z==2)
{ if(s2.memberof(y))
cout<<" yes "<else
cout<<" No "<cout<}
else if(z==3)
{ if(s3.memberof(y))
cout<<" yes "<else
cout<<" No "<cout<}
else if(z==4)
{ if(s5.memberof(y))
cout<<" yes "<else
cout<<" No "<cout<}
else if(z==5)
{ if(st4.memberof(y))
cout<<" yes "<else
cout<<" No "<cout<}



//////////////////////////////////////////////////////////////////////////
///////// INSERTING NUMBER to CURRENT SETS (s1,s2,s3) /////////
char ch;
cout<<" 1-first set : ";
s1.Display();
cout<cout<<" 2-second set : ";
s2.Display();
cout<cout<<" 3-third set : ";
s3.Display();
cout<cout<<" 4-unionset : ";
s5.Display();
cout<cout<<" 5-intersectionset : ";
st4.Display();
cout<
{

int f,g,loc;
cout<<" enter a number to insert ";
cin>>f;
cout<cout<<" Which set would you like to insert number "<cin>>g;
cout<<" Which location would you like to insert ? :";
cin>>loc;
if(g==1)

{ s1.Insertelem(f,loc);
s1.Display();
}
else if(g==2)
{ s2.Insertelem(f,loc);
s2.Display();
}
else if(g==3)
{ s3.Insertelem(f,loc);
s3.Display();
}
else if(g==4)
{ s5.Insertelem(f,loc);
s5.Display();
}
else if(g==5)
{
st4.Insertelem(f,loc);
st4.Display();
}
else if(g==5)
{
s.Insertelem(f,loc);
s.Display();
}
//////////////////////////////////////////////////////////////////////////
/////////// DELETING NUMBER from CURRENT SETS (s1,s2,s3) /////////
cout<
cout<<" 1-first set : ";
s1.Display();
cout<cout<<" 2-second set : ";
s2.Display();
cout<cout<<" 3-third set : ";
s3.Display();
cout<cout<<" 4-unionset : ";
s5.Display();
cout<cout<<" 5-intersectionset : ";
st4.Display();
cout<
cout<

int r;
cout<<" enter a number to delete : ";
cin>>r;
cout<<" from which set would you like to delete number "<cin>>g;


if(g==1)
{ s1.DeleteElem(r);
s1.Display();
}
else if(g==2)
{ s2.DeleteElem(r);
s2.Display();
}
else if(g==3)
{ s3.DeleteElem(r);
s3.Display();
}
else if(g==4)
{ s5.DeleteElem(r);
s5.Display();
}
else if(g==5)
{
st4.DeleteElem(r);
st4.Display();
}
else if(g==5)
{
s.DeleteElem(r);
s.Display();
}
}
////////////////////////////////////////////////////////////////////////////
///////////// FIRST AND SECOND set ARE EQUAL or NOT ///////////////////
cout<int temp;
temp=s1.Equal(s1,s2);
if(temp==1)
{ cout<<"first set : ";
s1.Display();
cout<<"second set : ";
s2.Display();
cout<<"they are equal "<}
else
{ cout<<"first set : ";
s1.Display();
cout<<"second set : ";
s2.Display();
cout<<"they are not equal "<} cout<



return 0;
Sayfa başına dön Aşağa gitmek
http://www.afdprogramlama.tr.gg
 
"C++" HAZIR KODLAR [27]
Sayfa başına dön 
1 sayfadaki 1 sayfası

Bu forumun müsaadesi var:Bu forumdaki mesajlara cevap veremezsiniz
FORUMCENTER :: KOD BANKASI :: c++ kodları-
Buraya geçin: