找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 1073|回复: 5

[原创]

[复制链接]
发表于 2009-10-31 01:55:25 | 显示全部楼层 |阅读模式 IP:江苏扬州
各位前辈我现在需要用c++编写的顺序结构,链式结构约瑟夫环程序,可不可以帮帮?
发表于 2009-10-31 01:55:26 | 显示全部楼层 IP:江苏扬州
我都没学过c++现在可是困难时期请多帮忙
回复

使用道具 举报

发表于 2009-10-31 01:55:27 | 显示全部楼层 IP:江苏扬州
呵呵,没学过,一上来就提我们这些稍微学过的人都觉的头疼的东西。谦虚吧,普通的约瑟夫问题解的称序行不?链表什么的我帮不上,你学数据结构呢吧?
回复

使用道具 举报

发表于 2009-10-31 01:55:27 | 显示全部楼层 IP:江苏扬州
我也是新手
希望能有人帮忙
回复

使用道具 举报

发表于 2009-10-31 01:55:29 | 显示全部楼层 IP:江苏扬州
普通的 我也找到了一些不知道 到底 属于那类 #include<iostream.h> #include<iomanip.h>
struct josephus { int code; josephus * next; };
void main() { int number; int interal; cout<<"Please input the number of children: "; cin>>number; cout<<"Please input the interal of counting: "; cin>>interal; josephus * ptrJose=new josephus[number]; josephus * ptrCurrent=ptrJose; int count=0; cout<<"Now There are "<<number<<" in the queue:"; for(int i=1;i<=number;i++) { ptrCurrent->next=ptrJose+i%number; ptrCurrent->code=i; ptrCurrent=ptrCurrent->next; if(count++ % 10==0) cout<<endl; cout<<setw(4)<<i; } cout<<endl<<endl; josephus * pivot; ptrCurrent=&ptrJose[number-1]; while(ptrCurrent->next!=ptrCurrent) { for(int j=0;j<interal;j++) { pivot=ptrCurrent; ptrCurrent=ptrCurrent->next; } cout<<"NO."<<setw(4)<<ptrCurrent->code<<" is eliminated."<<endl; pivot->next=ptrCurrent->next; ptrCurrent=pivot; } cout<<endl; cout<<"The winner is "<<ptrCurrent->code<<endl<<endl; delete[] ptrJose; }
回复

使用道具 举报

发表于 2009-11-1 19:05:02 | 显示全部楼层 IP:北京
那个贴子 让它沉下去吧! 不要啦
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 19:31 , Processed in 0.367443 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表