Input 'y' or 'n n do again getchar while (again!'y' again!'n if (again 'y printf nOK, let's go again!
You signed in with another tab or window.
You created a constant cards but then you only use it dmitry lesnoy poker once.There are 2 reasons: As it is now, it's difficult to find who changed them when they change.#include #include using namespace std; / Global Variables / char *card_num char *card_type / Structures / struct cardtype int color; int number; int value; ; struct decktype bool deck52; int size; ; / Functions / void SeedRandom time_t tTime; time( tTime srand(tTime rand struct cardtype.C sure is a hard language.Here are a few ways you could take it to the next level.'n printf n /shuff the cards shuff(cards /give the cards pcards0cards0; pcards1cards1; bcards0cards2; bcards1cards3; /the 2 cards player get printf One of computer's cards:n pic(bcards0 printf n printf Cards of player:n pic(pcards0 /printf n pic(pcards1 /printf n i0; for (i0; i 2; i) if (pcardsi100.Press h to open a hovercard with more details).It's obvious you put a lot of effort into this program.You're initially dealt 2 cards, before you hit or stay, not one.
Also, your code is logically laid out in functions, so it's easy to read and lotto 6 aus 49 archiv add or subtract things in the future.
You could do this more easily with an array, like this: const char* csuit(const int v) const char* kSuits "Hearts "Clubs "Diamonds "Spades" ; return kSuits v 4 ; You can do a similar thing with cface.Press Enter to.If you ever want to expand this (perhaps to be a server that serves games to multiple groups of people at the same time having globals won't work.N return 1; else if (psum 21) printf Sum of player's cards now:dnn psum printf Player win!On the subject of simplifying, I'd probably also break turn into smaller functions, and try to make the logic simpler.N return 0; /the 2 cards of boss/computer /i0; printf Computer's cards:n pic(bcards0 pic(bcards1 if (bcards0100 bcards1100 2) bsum12; /two A cards printf Sum of computer's cards now:dnn bsum else if (convert_jkq(bcards0)100 (convert_jkq(bcards1)100 1) bsum21; printf Sum of computer's cards now:dnn bsum printf Computer win!Here's the code and of course an image to demonstrate what it does.
In your csuit and cface functions, you have a bunch of case statements to convert between an int and a string.