当前位置:网站首页>Basic methods of realizing licensing function in C language
Basic methods of realizing licensing function in C language
2022-07-26 05:16:00 【an520_】
Hello everyone !
Today I would like to talk with you , How to use it C Language implementation of automatic licensing program .
First of all : Problem description
A deck of poker has 52 card , When you play bridge, you should give the cards to 4 personal . Please design a program to complete the automatic licensing work . requirement : For spades S (Spaces) Express , For hearts H (Hearts) Express , Square with D (Diamonds) Express , Plum blossom with C (Clubs) Express .
second : Problem analysis
Ideas :
This problem is relatively simple to realize , Just define two multidimensional character arrays , The first number used to store poker , The second is for storing 4 A player's hand .
52 A card is given to 4 personal , Need to send 13 round , Each round deals cards to players in the order of their numbers , When licensing , Generate the number to be dealt with a random function ( For the introduction of random functions, please refer to my chapter 61 Days of practice ), If the card has not been issued before ( The issued cards are used for '\0' Mark ), Then the card number is stored in the player's hand array , At the same time, assign the number of the card to '\0'. If the card corresponding to the generated random number has been dealt , Then continue to generate new random numbers . When 52 All cards have been issued , Print the result of the deal .
Poker array char poker[4][13]; Medium 4 There are four kinds of designs and colors ,13 Indicates that each has 13 Zhang (13 Number ), The number of playing cards ( name ) To express in characters , Respectively :{'2', '3', '4', '5', '6', '7', '8', '9', '0', 'J', 'Q', 'K', 'A'}('0' Express 10)
The player's hand array is a three-dimensional character array ,char players[PLAYER_NUMBER][4][13] = {0}; (PLAYER_NUMBER It's the number of players ,4 The colors and types of the sign are 4 Kind of ,13 The most cards for a suit 13 Zhang )
On initialization , All values of the hand array are set to '\0', No card on hand .
Third : Code implementation




Fourth : Running results

summary : Only practice more , In the process of practicing , Find the problem points, solve them one by one and summarize , To go further .
【 Learning exchange group 769843038】
【 Share some tutorial materials below 】:
C The language expression program is written like this ,99.9% To succeed !
C The link list of basic language tutorials
c Automatic language compilation , Effectively improve your development efficiency !
1 Hours to get you started Linux Next C Language development
c Code debugging is more efficient in this way
C Fundamentals of language programming
【 Free information package on the net disk below , Rest assured to receive what you need 】:
Embedded Internet of things stm32 c/c++、QT Linux Data package 【 Huaqing vision issued the information package 】
http://makerschool.mikecrm.com/7ADq4jq

边栏推荐
- security权限管理详解
- Embedded sharing collection 20
- Map making of environmental impact assessment based on remote sensing interpretation and GIS technology
- Test of countlaunch demo
- Use flutter to adjust a color filter for the picture of my little sister
- Improve reduce parallelism in shuffle operation
- ThreadLocal transfer between parent and child threads in asynchronous
- CMD操作命令
- Practical technology of SWAT Model in simulation of hydrology, water resources and non-point source pollution
- 新导则下的防洪评价报告编制方法及洪水建模
猜你喜欢

攻防世界--easy_web

C语言力扣第41题之缺失的第一个正数。两种方法,预处理快排与原地哈希

安装NCCL\mpirun\horovod\nvidia-tensorflow(3090Ti)

第二讲 初识SLAM

阿里三面:MQ 消息丢失、重复、积压问题,如何解决?

Go-Excelize API源码阅读(六)—— DeleteSheet(sheet string)

面试之请详细说下synchronized的实现原理以及相关的锁

ALV program collection

Improve reduce parallelism in shuffle operation

Redis expiration deletion strategy and memory obsolescence strategy
随机推荐
【Leetcode】493. Reverse Pairs
Leetcode linked list problem - 203. remove the linked list elements (learn the linked list by one question and one article)
517. 超级洗衣机
npm操作指令
@Principle of Autowired annotation
unity场景跳转脚本
Nacos 介绍和部署
Recommend 12 academic websites for free literature search, and suggest to like and collect!
C语言函数
CLM land surface process model
Leetcode linked list problem - 206. reverse linked list (learn linked list by one question and one article)
Excel VBA: summarize calculation output results by date (SUMIF)
MODFLOW Flex、GMS、FEFLOW、HYDRUS实践应用
Week 6 Learning Representation: Word Embedding (symbolic →numeric)
[acwing] 1268. Simple questions
A material of machine learning
注解@Autowired如何自动装配
测试用例评审如何开展
家居vr全景展示制作提高客户转化
Webassembly 01 basic information