Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
10_2.cpp
Package: c.rar [view]
Upload User: puke2000
Upload Date: 2022-07-25
Package Size: 912k
Code Size: 1k
Category:
CSharp
Development Platform:
Visual C++
- //10_2
- #include <iostream.h>
- #include <string.h>
- struct Node{
- char str[20];
- Node* next;
- };
- void Insert(Node*& head);
- void main()
- {
- Node* p;
- Node* x=new Node;
- strncpy(x->str,"hello",20);
- x->next = NULL;
- p =x;
- x=new Node;
- strncpy(x->str,"jone",20);
- x->next = p;
- p=x;
- x=new Node;
- strncpy(x->str,"good",20);
- x->next = p;
- p=x;
- x=new Node;
- strncpy(x->str,"better",20);
- x->next = p;
- p=x;
- cout <<"n插入之前:n";
- for(Node* pT=p; pT; pT=pT->next)
- cout <<pT->str <<"->";
- cout <<"0n";
- Insert(p);
- cout <<"n插入之后:n";
- for(Node* pT=p; pT; pT=pT->next)
- cout <<pT->str <<"->";
- cout <<"0n";
- }
- void Insert(Node*& head)
- {
- Node* p=new Node;
- strncpy(p->str,"marit",20);
- head->str[19]='';
- if(!head){
- head = p;
- p->next = NULL;
- return;
- }
- if(!strcmp(head->str, "jone")){
- p->next = head;
- head = p;
- return;
- }
- Node* sp;
- for(sp=head; sp->next&& strcmp(sp->next->str,"jone"); sp=sp->next);
- p->next = sp->next;
- sp->next = p;
- }