int pos;
cin >> pos;
if (pos < 1 || pos > L->length) { // 假设链表头节点存储length属性表示链表长度
cout << "Sorry,the position to be deleted is invalid!" << endl;
return ERROR;
}
LinkList p = L;
int cnt = 0;
while (p != NULL && cnt < pos - 1) {
p = p->next;
cnt++;
}
LinkList q = p->next;
p->next = q->next;
delete q;
LinkList cur = L->next;
while (cur != NULL) {
cout << cur->data.no << " " << cur->data.name << " "
<< fixed << setprecision(2) << cur->data.price << endl;
cur = cur->next;
}
return OK;