#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(void)
{
int t,w=0,l=0;
do{
int i,j;
float computer=0,player=0,ans1=0,ans2=0;
srand(time(NULL));
do{
player=rand()%13+1;
if(player==11||player==12||player==13){
player=0.5;
ans1+=player;
}
else{
ans1+=player;
}
printf("This is your PK %f\n",ans1);
if(ans1>10.5)
{
//printf("you lose\n");
break;
}
printf("Do you want to one more ?\n");
printf("If you want enter 1 else enter 0\n");
scanf("%d",&i);
}
while(i!=0);
do{
computer=rand()%13+1;
if(computer==11||computer==12||computer==13){
computer=0.5;
ans2+=computer;
}
else {
ans2+=computer;
}
if(ans2<=7) j =1;
else j = 0;
}while(j!=0);
//printf("%d",ans1);
printf("This is mine %f\n",ans2);
if(ans1>ans2&&ans1<=10.5){printf("Your win!\n");
w++;}
else if(ans2>10.5){printf("Your win!\n");
w++;}
else{ printf("Your lose!\n");
l++;}
printf("Do you want to play again?(if you want please enter 1 else enter 0)\n");
scanf("%d",&t);
}while(t!=0);
printf("You win %d time\n",w);
printf("You lose %d time\n",l);
return 0;
}
ten_and_half's Introduction
ten_and_half's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.