单向循环链表在线求教
#include "stdafx.h"#include <iostream>using namespace std;struct Node { Node() { num = 0; flag = 'S'; next = NULL; } ~Node() { delete next; next = NULL; } int num; char flag; Node* next;};int main(int argc, char* argv[]){ int N = 1; Node *pHead; pHead = new Node; Node *p = pHead; cin>>N; for (int i = 0;i<N;i++) { p = new Node; p->num = i+1; p->flag = 'S'; p->next = pHead; p = p->next; } p = pHead; p = p->next; cout<<p->num<<endl; return 0;}