博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
004 -- Circle LinkList 3 -- Puzzels_Magic Poker and Latin
阅读量:5794 次
发布时间:2019-06-18

本文共 2771 字,大约阅读时间需要 9 分钟。

000--Magic Poker

Put the poker with specific sequence, so that they can show as below:

count 1, open the first card as A, count 2, the first one place to bottom and open the second one as 2; for 3, the first 2 cards put to the bottom, and open the third one 3 ......

#include 
#include
#define CardNumber 13 typedef struct node{ int data; struct node *next;}sqlist, *linklist;linklist CreateLinkList(){ linklist head = NULL; //the head node with NULL linklist s, r; int i; r = head; for(i=1;i<=CardNumber;i++) { s = (linklist)malloc(sizeof(sqlist)); s->data = 0; if(head==NULL) head = s; // for the first newly create node, it becomes head now. the next time, head = o. else r->next = s; r = s; } r->next = head; //the last node points to the first node=head return head;}//count the sequence for distributing the cardvoid Magician(linklist head){ linklist p; int j; int Counter = 2; p=head; p->data = 1; //the first card as 1 while(1) { for(j=0;j
next; if(p->data!=0) { p->next; j--; } } if(p->data == 0) { p->data = Counter; Counter++; if(Counter==14) break; } }}void DestroyList(linklist* list){ free(list);}int main(){ linklist p; int i; p = CreateLinkList(); Magician(p); printf("please set the card with the sequece as below: \n"); for(i=0;i
data); p=p->next; } DestroyList(&p); return 0;}

 

001-- Latin print 

#include 
#include
typedef struct node{ int data; struct node *next;}sqlist, *linklist;linklist CreateLinkList(){ linklist head = NULL; linklist s,r; int i,n ; printf("please input the latin Number you want to create: "); scanf("%d\n", &n); r = head; for(i=1;i<=n;i++) { s = (linklist)malloc(sizeof(sqlist)); s->data = i; if(head==NULL) head=s; else r->next = s; r=s; } r->next = head; return head;}void PrintLatin(linklist head){ linklist p,q; int i,j,n; printf("please input the latin Number you want to create: "); scanf("%d\n", &n); q=p=head; for(i=0;i
data); p = p->next; } printf("\n"); q = q->next; p = q; }}int main(){ linklist p; p=CreateLinkList(); PrintLatin(p); return o;}

 

 

转载于:https://www.cnblogs.com/Shareishappy/p/7529891.html

你可能感兴趣的文章
HDU-1222 Wolf and Rabbit (欧几里得定理)
查看>>
Camera Calibration 相机标定:原理简介(五)
查看>>
ehcache实例
查看>>
python 匿名函数
查看>>
javascript实现-------------选择排序
查看>>
成功复活 Casio PB-300 的打印模块
查看>>
讲真:序列化必读
查看>>
centOS中VMware Tools 安装
查看>>
oracle中以dba_、user_、v$_、all_、session_、index_开头的常...
查看>>
leetcode 116- Populating Next Right Pointers in Each Node
查看>>
递推练习 简单n!
查看>>
spring项目启动错误——java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext...
查看>>
Android中解析XML
查看>>
关于 visual studio 扩展与更新 搜索不到qt的解决方案
查看>>
iOS开发网络篇—GET请求和POST请求
查看>>
字典dict
查看>>
游戏名词解释
查看>>
mongodb数据的导出和导入
查看>>
白话算法(7) 生成全排列的几种思路(二) 康托展开
查看>>
d3 v4实现饼状图,折线标注
查看>>