You are on page 1of 3

#include <stdio.

h>
#include <conio.h>
#include <string.h>
#include <dos.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <ctype.h>
void main()
{
_setcursortype(_NOCURSOR);
clrscr();
struct time t;
struct time i;
struct
{
int nilai_kartu;
}kartu[52];

struct dostime_t r;

awal:
clrscr();
randomize();
int x,d;
float score;
float cnt=0;
gettime(&t);
gettime(&i);
int temp;
int time1=0,time2=0;

printf("MASUKKAN NILAI UJI:");


scanf("%i",&d);
if(d==0)
{
exit(1);
}
else
{
goto lanjut;
}
lanjut:
_dos_gettime(&r);
time1=r.second;
temp=time1;
score=0;
clrscr();

bagi_kartu:
//clrscr();
_dos_gettime(&r);
time2=r.second;
temp=time2-time1;
if(time2<time1)
{
temp=60-time1+time2;
}
if((temp)==10)
{
clrscr();
printf("komputer anda komputer jadul kah?");
getch();
goto awal;
}
x=0;
do
{
//delay(100);
kartu[x].nilai_kartu=rand()%d+1;

for(int y=0;y<=x;y++)
{
for(int z=0;z<=x;z++)
{
if(y!=z)
{

if(kartu[y].nilai_kartu==kartu[z].nilai_kartu)
{
cnt=0.00;
delay(1000);
if(kbhit())
{

goto awal;

goto bagi_kartu;
}
else
{

}
else
{

}
}
}
x++;
int ccc;
ccc=d/x;
cnt=99.99/ccc*0.99;
if(cnt<=100)
{

if(score>cnt)
{
//printf("\t\t\tbest record:
%0.2f\n",score);
//printf("LOADING\t%0.2f%",cnt);
}
else
{
printf("\nLOADING\t%0.2f%",cnt);
printf("\t\t\tbest record:%0.2f
%",score);
score=cnt;

}
}
}while(x!=d);

printf("\nLOADING 100.00%\t\t\tbest record:100%\n");


_dos_gettime(&r);
time2=r.second;
temp=time2-time1;
if(time2<time1)
{
temp=60-time1+time2;
}
printf("\nstart time :%ds\nend time :%ds\nwaktu total:
%02ds\n\n",time1,time2,temp);

x=0;
do
{
printf("%i ",kartu[x].nilai_kartu);
x++;
}while(x!=d);

getch();
goto awal;
}

You might also like