Welcome Guest, Not a member yet? Register   Sign In
Solitaire in c programming
#1

[eluser]Unknown[/eluser]
Code:

#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <conio.c>

this thing only do is generate the number:

int random(int x)
{
srand((int) time(NULL));
return 1 + rand() % x;
}

and this, the colors:
void cardcolr(int naipe,int cardwcolr)
{
if (naipe == 1) // Hearts
{
switch(cardwcolr)
{
case 1:
textcolor(LIGHTRED);
printf(" A\3");
break;
case 11:
textcolor(LIGHTRED);
printf(" J\3");
break;
case 12:
textcolor(LIGHTRED);
printf(" Q\3");
break;
case 13:
textcolor(LIGHTRED);
printf(" K\3");
break;
default:
textcolor(LIGHTRED);
printf(" %d\3",cardwcolr);
}
}
if (naipe == 2) // Spades
{
switch(cardwcolr)
{
case 1:
textcolor(BLACK);
printf(" A\6");
break;
case 11:
textcolor(BLACK);
printf(" J\6");
break;
case 12:
textcolor(BLACK);
printf(" Q\6");
break;
case 13:
textcolor(BLACK);
printf(" K\6");
break;
default:
textcolor(BLACK);
printf(" %d\6",cardwcolr);
}
}
if (naipe == 3) // Diamonds
{
switch(cardwcolr)
{
case 1:
textcolor(LIGHTRED);
printf(" A\4");
break;
case 11:
textcolor(LIGHTRED);
printf(" J\4");
break;
case 12:
textcolor(LIGHTRED);
printf(" Q\4");
break;
case 13:
textcolor(LIGHTRED);
printf(" K\4");
break;
default:
textcolor(LIGHTRED);
printf(" %d\4",cardwcolr);
}
}
if (naipe == 4) // Clubs
{
switch(cardwcolr)
{
case 1:
textcolor(BLACK);
printf(" A\5");
break;
case 11:


Messages In This Thread
Solitaire in c programming - by El Forum - 04-04-2009, 03:35 AM
Solitaire in c programming - by El Forum - 04-04-2009, 03:47 AM
Solitaire in c programming - by El Forum - 04-06-2009, 05:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB