LNK2019 无法解析的外部符号 _WinMain@16怎么回事

#include
using namespace std;
void Josehus(int n, int k);
struct Node
{
int data;
struct Node*next;
};
int main()
{
int n, k;
cin >> n >> k;
Josehus(n, k);
return 0;
}
void Josehus(int n, int k)
{
Node*rear = new Node;
Node*front = new Node;
rear->data = 0;
rear->next = front;
front->next = rear;
for (int i = n; i > 0; i--)
{
Node*s = new Node;
s->next = front->next;
s->data = i;
front->next = s;
}
int j = 1;
Node*p = front->next;
while (rear->next != rear)
{
while (j != k - 1)
{
p = p->next;
j++;
}
if (p->next == rear)
{
cout << rear->next->next->data;
Node*q = p->next;
p->next = q->next;
delete q;
}
else if (p->next == rear->next)
{
cout << rear->next->next->data;
Node*q = p->next;
p->next = q->next;
delete q;
}
else
{
cout << p->next->data;
Node*q = p->next;
p->next = q->next;
delete q;
}
}
}

1个回答

你的代码跟工程类型不对。你用VC的向导建立控制台工程,然后添加代码

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐