Programalama > C++

Etiketler: --futbol--

Ort. 0
Puan ver:
#include<iostream>
#include<string>
#include<cstdlib>
#include<ctime>

using namespace std;








class Oyuncu{

public:
	Oyuncu(int b=1,int c=1,int d=0,int e=1,int f=0,char *isim="Adsiz")
	{
		power=b;
	
		speed=c;
	
		defence=d;
	
		attack=e;
	
		tecrube=f;

		sayi++;
		ad=isim;

		//cout<<"Yeni Bir Oyuncu Dogdu :)"<<ad<<"\nOyuncu Sayisi: "<<sayi<<"\n"<<endl;

	}
/////////////////////////////////////////////////////////////////////////////////////////////

	~Oyuncu()
	{
	
		//cout<<ad<<"  Oyuncusu oldu :'( "<<endl;
		sayi--;

	//cout<<"Oyuncu Sayisi :"<<sayi<<endl;
	}

//////////////////////////////////////////////////////////////////////////////////////////////

	void setpower(int a)
	{
		power=a;
	}


	void setspeed(int a)
	{
		speed=a;
	}


	void setdefence(int a)
	{
		defence=a;
	}


	void setattack(int a)
	{
		attack=a;
	}

	void setname(char *a)
	{
	
		ad=a;
	}
///////////////////////////////////////////////////////////////////////////////
	void kazanma()
	{
	
		tecrube++;
	}
///////////////////////////////////////////////////////////////////////////////

	int getpower()
	{
		return power;
	}

	int getspeed()
	{
		return speed;
	}

	int getdefence()
	{
		return defence;
	}

	int getattack()
	{
		return attack;
	}

	int gettecrube()
	{
		return tecrube;
	}

	char * getname()
	{
	return ad;
	}
///////////////////////////////////////////////////////////////////////////////
static int getsayi()
{

	return sayi;
	cout<<"Toplam Oyuncu Sayisi= "<<sayi<<endl;
}

///////////////////////////////////////////////////////////////////////////////
void print()
{
	cout<<ad<<"\n\nPower= "<<power<<"\nSpeed= "<<speed<<"\nDefence= "<<defence<<"\nAttack= "<<attack<<"\nTecrube= "<<tecrube<<"\n--------------------------------------------------------------------\n"<<endl;
}

void powerarttir()
{
power++;

}





private:
	int power;
	int speed;
	int defence;//=PUAN
	int attack;
	int tecrube;
	char *ad;



	static int sayi;


};


int Oyuncu::sayi=0;



int main()
{
	srand(time(NULL));
	int takim;
	int menu;
	int rakip;
	Oyuncu array[20];

	array[0].setname(" Chealsea");
	array[1].setname(" Manchester United");
	array[2].setname(" Galatasaray");
	array[3].setname(" Besiktas");
	array[4].setname(" Fenerbahce");
	array[5].setname(" Arsenal");
	array[6].setname(" Barcelona");
	array[7].setname(" Neftchi");
	array[8].setname(" Real Madrid");
	array[9].setname(" Bayern Munchen");
	array[10].setname("AC Milan");
	array[11].setname("Lyon");
	array[12].setname("Spartak Moskova");
	array[13].setname("Inter Milan");
	array[14].setname("Xezer Lenkeran");
	array[15].setname("Porto");
	array[16].setname("Juventus");
	array[17].setname("PSV");
	array[18].setname("Fiorentina");
	array[19].setname("Liverpool");
	

	array[0].setpower(3);
	array[1].setpower(3);
	array[2].setpower(1);
	array[3].setpower(1);
	array[4].setpower(1);
	array[5].setpower(2);
	array[6].setpower(3);
	array[7].setpower(1);
	array[8].setpower(3);
	array[9].setpower(3);
	array[10].setpower(3);
	array[11].setpower(1);
	array[12].setpower(1);
	array[13].setpower(2);
	array[14].setpower(1);
	array[15].setpower(1);
	array[16].setpower(2);
	array[17].setpower(1);
	array[18].setpower(1);
	array[19].setpower(3);






	


	cout<<"Takimini Sec !"<<endl;
	for(int k=0;k<=19;k++)
	{
	
		cout<<"<"<<k<<"> "<<array[k].getname()<<endl;
	}

	cin>>takim;

	array[takim].print();

		while(1<5){


	cout<<"--------------------------------------------------------------------\n"<<"<1> Mac Yap\n"<<"<2> Antrenman Yap\n"<<"<3> ***LEAGUE CHAMPIONS***\n"<<endl;

	cin>>menu;

	switch (menu)
	{
	case 1:
			cout<<"Rakip Sec !"<<endl;
	for( k=0;k<=19;k++)
	{
	
		cout<<"<"<<k<<"> "<<array[k].getname()<<endl;
	}

	cin>>rakip;

	array[rakip].print();


	cout<<"Oyun Basliyor...\n"<<endl;
	cout<<"ilk Yari Sonucu:"<<endl;

	int a;
	int b;
	int c;
	int d;


	a=rand()%array[takim].getpower();
	b=rand()%array[rakip].getpower();

	c=rand()%array[takim].getpower()+1;
	d=rand()%array[rakip].getpower();

	cout<<array[takim].getname()<<" "<<a<<":"<<b<<" "<<array[rakip].getname()<<endl;
	cout<<"Mac Sonucu: "<<endl;
	cout<<array[takim].getname()<<" "<<a+c<<":"<<b+d<<" "<<array[rakip].getname()<<endl;

	break;


	case 2:

		cout<<"Antrenman Agirligini Seciniz!\nDIKKAT:Oyunculari asiri yormaniz performanslarini dusurebilir..!\nAntreman Agirligi Gir (1-5 arasi..)"<<endl;
		int agirlik;

		cin>>agirlik;

		if(agirlik>=1 && agirlik<=5)
		
			{
			array[takim].powerarttir();
		}
		
break;



		case 3:
			cout<<"Sampiyonlar Ligi Basliyor...\nKuralar Cekiliyor..."<<endl;
			cout<<"A GRUBU-------------------------------------------------\n"<<endl;

			int komanda;

			int komandalar[20]={0};

			static int sira=1;

			static int grub=1;


			while(sira<5)
			{

			komanda=rand()%20;

			if(komandalar[komanda]==0)
			{
				 
				komandalar[komanda]=grub;
				cout<<sira<<")"<<array[komanda].getname()<<endl;
				sira++;
			}

			grub++;
			

			}

			cout<<"B GRUBU-------------------------------------------------\n"<<endl;

			sira=1;


						while(sira<5)
			{

			komanda=rand()%20;

			if(komandalar[komanda]==0)
			{
				 
				komandalar[komanda]=grub;
				cout<<sira<<")"<<array[komanda].getname()<<endl;
				sira++;
			}

			grub++;
			

			}



									cout<<"C GRUBU-------------------------------------------------\n"<<endl;

			sira=1;


						while(sira<5)
			{

			komanda=rand()%20;

			if(komandalar[komanda]==0)
			{
				 
				komandalar[komanda]=grub;
				cout<<sira<<")"<<array[komanda].getname()<<endl;
				sira++;
			}

			grub++;
			

			}


									cout<<"D GRUBU-------------------------------------------------\n"<<endl;

			sira=1;


						while(sira<5)
			{

			komanda=rand()%20;

			if(komandalar[komanda]==0)
			{
				 
				komandalar[komanda]=grub;
				cout<<sira<<")"<<array[komanda].getname()<<endl;
				sira++;
			}

			grub++;
			

			}

						/*cout<<"A Grubu Mac Sonuclari:"<<endl;

						int grubumuz[4]={0};
						int tocka=0;

						for(int k=0;k<=19;k++)
						{
							if(komandalar[k]==1){
								grubumuz[tocka]=k;
							tocka++;
							}

								
						
						}

						
	a=rand()%array[grubumuz[1]].getpower();
	b=rand()%array[grubumuz[2]].getpower();

	c=rand()%array[grubumuz[1]].getpower()+1;
	d=rand()%array[grubumuz[2]].getpower();

	cout<<array[grubumuz[1]].getname()<<" "<<a<<":"<<b<<" "<<array[grubumuz[2]].getname()<<endl;
	cout<<"Mac Sonucu: "<<endl;
	cout<<array[grubumuz[1]].getname()<<" "<<a+c<<":"<<b+d<<" "<<array[grubumuz[2]].getname()<<endl;
	*/


						





						




			
			




			break;
				}//end of switch
cout<<"<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n\n\n"<<endl;
	}//end of while

	return 0;
}

ferid mövsümov
faridm88@hotmail.com


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.