每一步都说的什么,#include using namespace std; const int people = 17; struct outt { outt *next; bool go; int num; }; int main( ) { outt *p,*head; int i,n = 0,t = 0; head = new outt; head->go = true; head->num = 1; p = head; for ( i = 1; i < p
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/01 06:42:29
![每一步都说的什么,#include using namespace std; const int people = 17; struct outt { outt *next; bool go; int num; }; int main( ) { outt *p,*head; int i,n = 0,t = 0; head = new outt; head->go = true; head->num = 1; p = head; for ( i = 1; i < p](/uploads/image/z/613062-54-2.jpg?t=%E6%AF%8F%E4%B8%80%E6%AD%A5%E9%83%BD%E8%AF%B4%E7%9A%84%E4%BB%80%E4%B9%88%2C%23include+using+namespace+std%3B+const+int+people+%3D+17%3B+struct+outt+%7B+outt+%2Anext%3B+bool+go%3B+int+num%3B+%7D%3B+int+main%28+%29+%7B+outt+%2Ap%2C%2Ahead%3B+int+i%2Cn+%3D+0%2Ct+%3D+0%3B+head+%3D+new+outt%3B+head-%3Ego+%3D+true%3B+head-%3Enum+%3D+1%3B+p+%3D+head%3B+for+%28+i+%3D+1%3B+i+%3C+p)
每一步都说的什么,#include using namespace std; const int people = 17; struct outt { outt *next; bool go; int num; }; int main( ) { outt *p,*head; int i,n = 0,t = 0; head = new outt; head->go = true; head->num = 1; p = head; for ( i = 1; i < p
每一步都说的什么,
#include
using namespace std;
const int people = 17;
struct outt
{
outt *next;
bool go;
int num;
};
int main( )
{
outt *p,*head;
int i,n = 0,t = 0;
head = new outt;
head->go = true;
head->num = 1;
p = head;
for ( i = 1; i < people; i++ )
{
outt *s = new outt;
p->next = s;
s->go = true;
s->num = i + 1;
p = s;
}
p->next = head;
p = head;
while ( n = people - 1 )
{
t++;
if ( t % 3 == 0 )
{
if ( p->go )
{
n++;
p->go = false;
}
else
t--;
}
p = p->next;
}
p = head;
while ( p->go )
{
p = p->next;
}
cout num;
return 0;
}
每一步都说的什么,#include using namespace std; const int people = 17; struct outt { outt *next; bool go; int num; }; int main( ) { outt *p,*head; int i,n = 0,t = 0; head = new outt; head->go = true; head->num = 1; p = head; for ( i = 1; i < p
#include
using namespace std;
const int people = 17;
struct outt //定义一个结构
{
outt *next; //定义一个数据成员(指针)
bool go; //逻辑型变量
int num; //整型变量
};
int main( )
{
outt *p,*head;
int i,n = 0,t = 0;
head = new outt;//申请动态空间
head->go = true; //第一个节点为真
head->num = 1; //...
p = head; //在表头插如结点
for ( i = 1; i < people; i++ ) //循环
{
outt *s = new outt; //申请动态空间
p->next = s;
s->go = true;
s->num = i + 1;
p = s;
}
p->next = head;
p = head;
while ( n != people - 1 )
{
t++;
if ( t % 3 == 0 )
{
if ( p->go )
{
n++;
p->go = false;
}
else
t--;
}
p = p->next;
}
p = head;
while ( !p->go )
{
p = p->next;
}
cout num;
return 0;
}
太多了.