struct person{
int number;
person *prior;
person *next;
}用又向链表把17人的信息存起来,把表头传入void OutArray(person *head){
int i=0;
person *tp=NULL;
person *cp=head;
while(cp->next!=cp){
if(i==3 && cp->next!=cp){
tp=cp->next;
cp->prior->next=cp->next;
cp->next->prior=cp->prior;
cp=tp;
i=0;
}
else{
i++;
cp=cp->next;
}
} cout<<cp->number;
}
int number;
person *prior;
person *next;
}用又向链表把17人的信息存起来,把表头传入void OutArray(person *head){
int i=0;
person *tp=NULL;
person *cp=head;
while(cp->next!=cp){
if(i==3 && cp->next!=cp){
tp=cp->next;
cp->prior->next=cp->next;
cp->next->prior=cp->prior;
cp=tp;
i=0;
}
else{
i++;
cp=cp->next;
}
} cout<<cp->number;
}
解决方案 »
- 怎样将hashtable的数据写入csv文件,要求A列写key,B列写value
- 在hibernate里面${}取出来的字段如何截取字符串
- spring 利用security 登陆 session 重复创建的问题(高分求助)
- 请熟悉oauth协议的进来看看,小弟有疑惑请教
- Lucene的搜索优化问题?
- active directory域主备份
- EJB QL怎么写一条查询语句
- 各位高人 请问怎么用struts配置sqlserver2000的驱动啊
- Applet中屏幕闪烁
- 关于mybatis的collection嵌套结果的问题。
- 100分 怎么样实现一个页面HTTP代理?
- org.springframework.beans.factory.BeanCreationException
用j2me写的,最后一个是10号
int [] people = new int[17];
int lastPeople = 0;
public void getTheLastPeople(){
for(int i = 0; i < people.length; i++){
people[i] = i+1;
}
int count = 0;
int countLast = 0;
int j = 0;
while(true){
for(j = 0; j < people.length; j++){
if(people[j] != 0){
count++;
people[j] = count;
System.out.println("people[" + j + "] = " + people[j]);
if (people[j] % 3 == 0) {
people[j] = 0;
countLast++;
if(countLast == 17){
lastPeople = j;
return;
}
}
}
}
}
}