文件名称:joseph
- 所属分类:
- 其他小程序
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2013-05-20
- 文件大小:
- 42kb
- 下载次数:
- 0次
- 提 供 者:
- 蚊子***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
约瑟夫环:由约瑟夫环的游戏规则可知,在游戏中,我们需要输入的是总人数n值、一开始选的上限值m和每个人手中所持的密码值cipher。这些数都应该是正整数,且n小于等于30,若输入的是小于等于0的数,应该提醒输入有误。用scanf()函数实现输入操作,空格、回车或者Tab键位输入结束标志。
在程序根据输入的数据运行之后,按顺序输出出列人的编号num,用printf()函数实现。
程序执行的命令包括:①构造结构体;②链表动态内存申请;③逐个插入链表结点并储存结点内容;④形成循环链表;⑤删除结点并输出数据。
测试数据
m初值为20,n=7,7个人密码依次为:3,1,7,2,4,8,4
出列人的编号顺序是:6,1,4,7,2,3,5.-Josephus: Josephus rules of the game that, in the game, we need to enter the value of n is the total number began to select the upper limit of m and each held by the hands of the password value cipher. These numbers should be a positive integer and n is less than or equal to 30, if the input is less than or equal to 0, should remind entered incorrectly. Scanf () function input operation, space, Enter or Tab key bit input end marker. In the program run in accordance with the input data, output in order column No. num, with the printf () function to achieve. Program execution commands include: ① tectonic structure (2) linked list dynamic memory application (3) one by one into the linked list of nodes and storage node (4) the formation of a circular list the ⑤ delete nodes and output data. Test data initial value of 20 m, n = 7,7 Password: 3,1,7,2,4,8,4 out of the line numbering sequence is: 6,1,4,7,2,3 , 5.
在程序根据输入的数据运行之后,按顺序输出出列人的编号num,用printf()函数实现。
程序执行的命令包括:①构造结构体;②链表动态内存申请;③逐个插入链表结点并储存结点内容;④形成循环链表;⑤删除结点并输出数据。
测试数据
m初值为20,n=7,7个人密码依次为:3,1,7,2,4,8,4
出列人的编号顺序是:6,1,4,7,2,3,5.-Josephus: Josephus rules of the game that, in the game, we need to enter the value of n is the total number began to select the upper limit of m and each held by the hands of the password value cipher. These numbers should be a positive integer and n is less than or equal to 30, if the input is less than or equal to 0, should remind entered incorrectly. Scanf () function input operation, space, Enter or Tab key bit input end marker. In the program run in accordance with the input data, output in order column No. num, with the printf () function to achieve. Program execution commands include: ① tectonic structure (2) linked list dynamic memory application (3) one by one into the linked list of nodes and storage node (4) the formation of a circular list the ⑤ delete nodes and output data. Test data initial value of 20 m, n = 7,7 Password: 3,1,7,2,4,8,4 out of the line numbering sequence is: 6,1,4,7,2,3 , 5.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Joseph
......\Debug
......\.....\Joseph.exe
......\Joseph.cpp
......\Joseph.dsp
......\Joseph.dsw
......\Joseph.ncb
......\Joseph.opt
......\Joseph.plg