TAROT.

/*
 *
 *
 */

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main()
{
    int tmp;

    int in_hand[21] = {0};

    char name[20];

    char tarot[21][50] = {
        "[0]--->(The Fool, 0)",
        "[1]--->(The Magician, I)",
        "[2]--->(The High Priestess, II)",
        "[3]--->(The Empress, III)",
        "[4]--->(The Emperor, IV)",
        "[5]--->(The Hierophant, or the Pope, V)",
        "[6]--->(The Lovers, VI)",
        "[7]--->(The Chariot, VII)",
        "[8]--->(Strength, VIII)",
        "[9]--->(The Hermit, IX)",
        "[10]--->(The Wheel of Fortune, X)",
        "[11]--->(Justice, XI)",
        "[12]--->(The Hanged Man, XII)",
        "[13]--->(Death, XIII)",
        "[14]--->(Temperance, XIV)",
        "[15]--->(The Devil, XV)",
        "[16]--->(The Tower, XVI)",
        "[17]--->(The Star, XVII)",
        "[18]--->(The Moon, XVIII)",
        "[19]--->(The Sun, XIX)",
        "[20]--->(Judgement, XX)",
        "[21]--->(The World, XXI)"
    };

    printf("TAROT.\n");

    printf("Enter your name:");

    gets(name);

    int left_cards = 21;

    for(;left_cards > 0;){

        srand((int)time(0));

        tmp = rand()%21;

        if(!in_hand[tmp]){

            in_hand[tmp] = 1;

            if(left_cards > 1)
                printf("%s \n", tarot[tmp]);
            else
                printf("YOUR CARD:%s \n", tarot[tmp]);

            left_cards --;
        }
    }

    printf("\n");

    return 0;
}

TAROT.
Enter your name:xkfx
[18]--->(The Moon, XVIII)
[1]--->(The Magician, I)
[4]--->(The Emperor, IV)
[7]--->(The Chariot, VII)
[10]--->(The Wheel of Fortune, X)
[14]--->(Temperance, XIV)
[17]--->(The Star, XVII)
[20]--->(Judgement, XX)
[3]--->(The Empress, III)
[6]--->(The Lovers, VI)
[9]--->(The Hermit, IX)
[12]--->(The Hanged Man, XII)
[16]--->(The Tower, XVI)
[19]--->(The Sun, XIX)
[8]--->(Strength, VIII)
[11]--->(Justice, XI)
[0]--->(The Fool, 0)
[13]--->(Death, XIII)
[2]--->(The High Priestess, II)
[5]--->(The Hierophant, or the Pope, V)
YOUR CARD:[15]--->(The Devil, XV)

时间: 2024-07-30 16:52:29

TAROT.的相关文章