这是大小写出问题了吗
#include<iostream>#include<cstdlib>
#include<iomanip>
using namespace std;
#define OK 1
#define ERROR 0
typedef int Starus;
typedef int ElemType;
typedef struct LNode{
ElemType data;
struct LNode *next;
}LNode, *LinKlist;
ElemType survial;
Status InitList_CL(LinKlist &L){
L=new LNode;
L->next=L;
L->data=0;
return OK;
}
void CreateCL_Rear(LinKlist &L, int n){
int i;
LinKlist p,r;
if(n<1) return;
r=L;
cout<<"The sequence of n slaves:\n";
for(i=1;i<=n;i++){
p=new LNode;
p->data=i;
cout<<setw(3)<<i<<" ";
p->next=NULL;
r->next=p;
r=p;
L->data++;
}
cout<<endl<<endl;
r->next=L->next;
}
Status CLDelete(LinKlist &L,int m) {
LinKlist p,q;
int i;
p=L->next;
cout<<"The killed sequence of n slaves :\n";
while(L->data>0){
for(i=1;i<m-1;i++)
p=p->next;
cout<<setw(3)<<p->next->data<<" ";
q=p->next;
p->next=q->next;
delete q;
p=p->next;
L->data--;
if(L->data==1) survival=p->data;
}
cout<<endl<<endl;
L->next=L;
return OK;
}
int main(){
LinKlist L;
int Status_value,n=1,m=2;
do{
cout<<"Please input the number n of slaves(must n>0):"<<endl;
cin>>n;
}
while(n<1);
do{
cout<<"\nPlease input the count m for kill slaves (must m>1) :"<<endl;
cin>>m;
}while(m<2);
cout<<endl<<endl;
status_value=InitList_CL(L);
CreateCL_Rear(L,n);
status_value=CLDelete(L,m);
cout<<"\nThe survival of n slaves is the "<<survival<<"-th slave.\n\n";
system("pause");
return 0;
}
拼写错误
多多检查下#include<iostream>
#include<cstdlib>
#include<iomanip>
using namespace std;
#define OK 1
#define ERROR 0
typedef int Status; // 这里
typedef int ElemType;
typedef struct LNode{
ElemType data;
struct LNode *next;
}LNode, *LinKlist;
ElemType survival; // 这里
Status InitList_CL(LinKlist &L){
L=new LNode;
L->next=L;
L->data=0;
return OK;
}
void CreateCL_Rear(LinKlist &L, int n){
int i;
LinKlist p,r;
if(n<1) return;
r=L;
cout<<"The sequence of n slaves:\n";
for(i=1;i<=n;i++){
p=new LNode;
p->data=i;
cout<<setw(3)<<i<<" ";
p->next=NULL;
r->next=p;
r=p;
L->data++;
}
cout<<endl<<endl;
r->next=L->next;
}
Status CLDelete(LinKlist &L,int m) {
LinKlist p,q;
int i;
p=L->next;
cout<<"The killed sequence of n slaves :\n";
while(L->data>0){
for(i=1;i<m-1;i++)
p=p->next;
cout<<setw(3)<<p->next->data<<" ";
q=p->next;
p->next=q->next;
delete q;
p=p->next;
L->data--;
if(L->data==1) survival=p->data;
}
cout<<endl<<endl;
L->next=L;
return OK;
}
int main(){
LinKlist L;
int status_value,n=1,m=2; //这里
do{
cout<<"Please input the number n of slaves(must n>0):"<<endl;
cin>>n;
}
while(n<1);
do{
cout<<"\nPlease input the count m for kill slaves (must m>1) :"<<endl;
cin>>m;
}while(m<2);
cout<<endl<<endl;
status_value=InitList_CL(L);
CreateCL_Rear(L,n);
status_value=CLDelete(L,m);
cout<<"\nThe survival of n slaves is the "<<survival<<"-th slave.\n\n";
system("pause");
return 0;
} 是 还有不认真的问题 人造人 发表于 2021-10-4 11:45
还有不认真的问题
孩子太菜了,呜呜呜 大马强 发表于 2021-10-4 11:43
拼写错误
多多检查下
谢谢 giegie666 发表于 2021-10-4 12:30
孩子太菜了,呜呜呜
认真一点呀,一个字母一个字母的检查代码,这种拼写错误你能检查不出来?怎么可能检查不出来? 问题解决了,请设置【最佳答案】 giegie666 发表于 2021-10-4 12:30
谢谢
习惯看报错信息,你就会知道了
页:
[1]