单链表的建立/测长/打印
来源:互联网 发布:淘宝 苹果证书 编辑:程序博客网 时间:2024/05/18 13:30
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<conio.h>
using namespace std;
typedef struct student
{
int data;
struct student *next;
}node;
node *creat()
{
node *head, *p, *s;
int x, cycle = 1;
head = (node*)malloc(sizeof(node));
p = head;
while (cycle)
{
printf("\n please input the data:");
scanf("%d", &x);
if (x != 0)
{
s = (node*)malloc(sizeof(node));
s->data = x;
printf("\n%d", s->data);
p->next = s;
p = s;
}
else
cycle = 0;
}
head = head->next;
p->next = NULL;
printf("\n yyy %d", head->data);
return (head);
}
int length(node *head)
{
int n = 0;
node *p;
p = head;
while (p != NULL)
{
p = p->next;
n++;
}
return (n);
}
//单链表打印
void print(node *head)
{
node *p; int n;
n = length(head);
printf("\n Now,These %d records are:\n", n);
p = head;
while (p != NULL)
{
printf("\n uuu %d ", p->data);
p = p->next;
}
}
#include<stdio.h>
#include<string.h>
#include<conio.h>
using namespace std;
typedef struct student
{
int data;
struct student *next;
}node;
node *creat()
{
node *head, *p, *s;
int x, cycle = 1;
head = (node*)malloc(sizeof(node));
p = head;
while (cycle)
{
printf("\n please input the data:");
scanf("%d", &x);
if (x != 0)
{
s = (node*)malloc(sizeof(node));
s->data = x;
printf("\n%d", s->data);
p->next = s;
p = s;
}
else
cycle = 0;
}
head = head->next;
p->next = NULL;
printf("\n yyy %d", head->data);
return (head);
}
int length(node *head)
{
int n = 0;
node *p;
p = head;
while (p != NULL)
{
p = p->next;
n++;
}
return (n);
}
//单链表打印
void print(node *head)
{
node *p; int n;
n = length(head);
printf("\n Now,These %d records are:\n", n);
p = head;
while (p != NULL)
{
printf("\n uuu %d ", p->data);
p = p->next;
}
}
0 0
- 单链表的建立、测长和打印
- 单链表的建立/测长/打印
- 单链表的建立/测长/打印
- 单链表的建立、测长和打印
- 单链表建立 测长 打印
- 单链表的建立,测长,打印,删除,插入,排序,逆置
- 单链表的建立,测长,打印,删除,插入,排序,逆置
- 单链表的建立,测长,打印,删除,插入,排序,逆置
- 单链表的建立、测长、打印、删除节点、插入节点
- 编程实现一个单链表的建立/测长/打印
- 实现一个单链表的建立、测长、打印、删除、插入
- 单链表之建立/测长/打印
- 双向链表的建立/测长/打印
- 双链表的建立、测长、打印、删除、插入
- 问题9:编程实现一个单链表的建立/测长/打印以及结点的删除。
- 程序员面试宝典之数据结构基础----①单链表的建立、测长、打印(读后)
- 使用JAVA实现单链表的建立、测长、打印、删除、插入、排序、逆置
- 单链表的建立、测长、打印、删除节点、插入节点、排序、逆转
- LeetCode之Merge k Sorted Lists
- 过河问题
- 【poj】1328 Radar Installation 快排+贪婪
- Android开发——下载功能的逻辑和实现
- hdu 5289 Assignment 二分+RMQ 2015 Multi-University Training Contest 1 02
- 单链表的建立/测长/打印
- SSO简介
- tcpip问题(较全)
- 2015年多校联合训练第四场(Problem Killer)hdu5328
- 根据数据库动态创建CheckBox
- 黑马程序员-C语言中static、extern、typedef、enum使用的注意事项
- VVDocumenter Xcode6.4安装步骤(非常实用)
- Android的四种监听事件处理方式
- UVA10025连续自然数添上正负号得到固定的数