Sponsorlu Bağlantılar
#include<stdlib.h>
#include<time.h>
int rolldice(void);
int main()
{
int gamestatus,sum,mypoint;
srand(time(NULL));
sum=rolldice();
switch(sum){
case 7: case 11:
gamestatus=1;
break;
case 2: case 3: case 12:
gamestatus=2;
break;
default:
gamestatus=0;
mypoint=sum;
printf("Puaniniz = %d\n",mypoint);
break;
}
while(gamestatus==0) {
sum=rolldice();
if(sum==mypoint)
gamestatus=1;
else if (sum==7)
gamestatus=2;
}
if(gamestatus==1)
printf("Oyun kazanildi...\n");
else
printf("Oyun kaybedildi...\n");
system("pause");
}
int rolldice(void)
{
int die1,die2,worksum;
die1=1+(rand()%6);
die2=1+(rand()%6);
worksum=die1+die2;
printf("Attiginiz zarlar %d + %d = %d\n",die1,die2,worksum);
return worksum;
}
Sponsorlu Bağlantılar
Hiç yorum yok:
Yorum Gönder