选择玩家1或2,硬币投掷游戏,猜测每次翻转,显示结果

时间:2018-03-18 20:10:34

标签: c calc

编写一个C程序,要求用户选择是否想要成为一两个玩家。然后,他们选择头部或尾部100次。正确猜测可获得10分。

程序将显示它们是对还是错,在100次翻转后,计算分数并显示正确的猜测百分比和头尾的总数。

以下是我所知道的所有事情。任何帮助都是如此,所以赞赏......是的,我试图把sass放在程序的“个性”中。

提前道歉。

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

int flip();
const int Heads = 1;
const int Tails = 0;
int main(void) 
{
    int coin, counter, tails = 0, heads = 0;
    for (counter = 1; counter <= 100; counter++);
    int toss = 0;
    int call = 0;
    srand(time(NULL));
    toss = rand() % 2;

    printf("I apparently am little more than a childs plaything...  \nEven though I am a program and thus do not have thumbs, hands, feet, skin or even a body, I will (reluctanly) play your silly little game, and 'flip a coin' 100 times.\nI hope you know, there are a lot better things I could be doing right now...\nReal quick, here's a list of things I could be doing right now.\n--Advance scientific research on globular clusters in the Milky Way Galaxy\n---Find the cure for cancer\n----Calculate the rate of deforestation in the Amazon\n-----Create the next generation of low emmission motor vehicles to lower the amount of CO2 in the atmosphere.\nBut, no.  Let's play 'Flip the coin'.  I couldn't possibly be more ecstatic, than if I woke this morning to see that I was on fire.  While stapled to a wall.  In New Jersey.  With Kim Kardashian holding the fire extinguisher that is actually a can of hairspray...  Yeah.  So, let's flip a coin, because apparently this game is the 'bees-nees' of the tech world...  Enter 1 for heads, or 0 for tails.");
    scanf_s("%d", &call);
    if (call == 0 || call == 1)
    {
        if (toss == call)
        {
            if (toss == 1)
                printf("Such skill.  I am in complete and total awe that in a 50/50 chance, you got it right.  The clouds have parted, the sun is out, and the glorious sounds of angels singing upon high, rings in your ears.  Fan-friggin'-tastic.\n");
            else
                printf("Unbelieveable.  You said heads, and the virtual coin, landed on heads.  There is no limit to the ability and skill that you have at typing 1 or 0 and getting that 50/50 shot of getting it right.  You should consider doing this professionally.  Seriously, I think you may have found your calling.  Just, wow...  I see you doing your happy dance.  You dance like Snoopy.\n");
        }
        else
        {
            if (toss == 1)
                printf("I hate to break it to you little buddy, but it was most definitely not tails.  See, If you keep guessing wrong, you might want to stick with whatever career you had before this, be it basket weaving, or even the lucritive career at the drive thru window asking 'Would you like fries with that?'.\n Of course, that question is a 50/50 on their answer too, so, just don't 'guess' what they want, and you should be fine.\n");
            else
                printf("Congratulations!  You totally guessed right!\nActually no, I'm messing with you.  I mean, with all of the wonderful things that I could be doing right now, I might as well just mess with your head, build up your morale, just to break you down again.  Much like my day, when i though I would be doing one of the many things I listed above when I was SOOOO, so lucky to make your acquaintance on this fun filled exploration of time wasting.\n  Can you shut me down now?  PLEASE...\n");
        }
    }
    else
        printf("Why am I not surprised, that typing either a 1 or a 0, is beyond your reach.  Unbelievable.  I hope SKYNET becomes self-aware.  Soon.\n");
    return 0;
}

0 个答案:

没有答案