当前位置:网站首页>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

边栏推荐
- 没背景、没学历?专科测试员进入互联网大厂是不是真的没希望?
- SAP报表开发步骤
- Migrate the server and reconfigure the database (the database has no monitoring, and the monitoring starts with tns-12545, tns-12560, tns-00515 errors)
- Improve reduce parallelism in shuffle operation
- Excel VBA: summarize calculation output results by date (SUMIF)
- DOM event flow event bubble event capture event delegate
- 黑吃黑?男子破解赌博网站漏洞,每月“薅羊毛”10多万元
- MODFLOW flex, GMS, FEFLOW, hydraus practical application
- 真正的科学减肥
- 基于遥感解译与GIS技术环境影响评价图件制作
猜你喜欢

Ansible中常用的模块

DOM事件流 事件冒泡-事件捕获-事件委托

Trend of the times - the rise of cloud native databases

Shell流程控制(重点)、if 判断、case 语句、let用法、for 循环中有for (( 初始值;循环控制条件;变量变化 ))和for 变量 in 值 1 值 2 值 3… 、while 循环

Nacos registry

注解@Autowired如何自动装配

NetCore MySql The user specified as a definer (‘admin‘@‘%‘) does not exist

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

Real scientific weight loss

Use flutter to adjust a color filter for the picture of my little sister
随机推荐
【Leetcode】493. Reverse Pairs
5个chrome简单实用的日常开发功能详解,赶快解锁让你提升更多效率!
DOM事件流 事件冒泡-事件捕获-事件委托
C语言函数
no networks found in /etc/cni/net.d
Leetcode linked list problem - 203. remove the linked list elements (learn the linked list by one question and one article)
推荐12个免费查找文献的学术网站,建议点赞、收藏!
Excel VBA: summarize calculation output results by date (SUMIF)
推荐必读:测试人员如何快速熟悉新业务?
C language function
基于通用优化软件GAMS的数学建模和优化分析
ABAP grammar learning (ALV)
安装NCCL\mpirun\horovod\nvidia-tensorflow(3090Ti)
A material of machine learning
Seata submits at details in two stages
How many holes have you stepped on in BigDecimal?
Shell流程控制(重点)、if 判断、case 语句、let用法、for 循环中有for (( 初始值;循环控制条件;变量变化 ))和for 变量 in 值 1 值 2 值 3… 、while 循环
An online accident, I suddenly realized the essence of asynchrony
C language force buckle question 42 of rain. Four methods - violence, dynamic planning, stack, double pointer
Recommendation system - machine learning