有N个数,使前面各数顺序向后移M个位置,最后M个数变成最前面M个数.最好能用指针.
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/19 05:14:08
有N个数,使前面各数顺序向后移M个位置,最后M个数变成最前面M个数.最好能用指针.
VC6.0下编译
#include
struct node
{
int value;
node* next;
};
void main()
{
node *head,*temp;
head=new node[];
temp=head;
int N,M,i;
cin>>N;
cin>>M;
for(i=0;i>temp->value;
temp->next=new node[];
temp=temp->next;
}
cin>>temp->value;
temp->next=NULL;
temp=head;
for(i=1;inext;
}
node *head2,*tail2;
head2=temp->next;
tail2=temp;
while(temp->next!=NULL)
{
temp=temp->next;
}
temp->next=head;
temp=head2;
while(temp->next!=tail2)
{
coutnext;
}
cout
#include
struct node
{
int value;
node* next;
};
void main()
{
node *head,*temp;
head=new node[];
temp=head;
int N,M,i;
cin>>N;
cin>>M;
for(i=0;i>temp->value;
temp->next=new node[];
temp=temp->next;
}
cin>>temp->value;
temp->next=NULL;
temp=head;
for(i=1;inext;
}
node *head2,*tail2;
head2=temp->next;
tail2=temp;
while(temp->next!=NULL)
{
temp=temp->next;
}
temp->next=head;
temp=head2;
while(temp->next!=tail2)
{
coutnext;
}
cout
有N个数,使前面各数顺序向后移M个位置,最后M个数变成最前面M个数.最好能用指针.
有n个整数,使其前面各数顺序向后移m个位置,最后m个数变成最前面m个数,必须用指针
c语言题目 有n个整数,使前面各数顺序向后移动 m个位置,最后m个数变成最前面m个数,要求用指针.
java实现有n个整数,使其前面各数顺序向后移m个位置,最后m个数变成最前面的m个数
如何用java写:有n个整数,使其前面各数顺序向后移m个位置,最后m个数变成最前面的m个数
c语言有n个整数,使前面各数顺序向后移m个位置,最后m个数变成最前面m个数
有n个整数,使前面各数顺序向后移m个位置,最后m个数变成最前面m个数.
C语言:有n个整数,使前面各数顺序向后移m个位置,最后m个数变成前面m个数.写一函数实现
C++ 有n个整数,使前面各数顺序向后移m个位置,最后m个数变成前面m个数
有N个整数的数组,使前面各数顺序向后移M位,原来最后M个数变成最前面的M个数
有n个整数,使前面个数顺序向后移m个位置,最后m个数变成最前面m个数.运用指针和函数调用,且n为不定值
c语言编程 有N个整数,使其前面各数顺序向后移动M个位置,最后M个数变成前面的M个数