网页学习体会

  • 首页
  • 个人博客
您的位置: 首页  >  IT文章  >  c++学习-链表

c++学习-链表

分类: IT文章 • 2024-09-30 19:20:36

静态链表:

#include<iostream>
#include<string>
using namespace std;


struct book{
    int num;
    float price;
    struct book *next;
};

int main()
{
    book x, y, z, *head, *p;
    x = {1,1.1f};
    y = { 2, 2.2f };
    z = { 3, 3.3f };

    head = &x;
    x.next = &y;
    y.next = &z;
    z.next = NULL;

    p = head;
    while (p!=NULL)
    {
        cout << p->num<<'	'<<p->price << endl;
        p = p->next;
    }
    return 0;
}

相关推荐

  • windows下《七天学会NodeJS》学习笔记之四--网络操作 开门红 API走马观花 典型应用场景
  • C++中的string
  • C++中的unordered_map
  • leetCode书房之链表(LC实现链表)
  • C++中的vector
  • windows下《七天学会NodeJS》学习笔记之一--NodeJS基础
  • C++中的栈和队列
  • windows下《七天学会NodeJS》学习笔记之三--文件操作 小文件拷贝 大文件拷贝 Buffer(数据块)http://nodejs.org/api/buffer.html Stream(数据流)[http://nodejs.org/api/stream.html) File System(文件系统)[http://nodejs.org/api/fs.html) Path(路径)[http://nodejs.org/api/path.html) 遍历目录 文本编码
  • 博览网C++学习第五周
  • C++基础练习案例
  • 数字间空格过滤
  • ios学习资料(一) Effective Objective-C 2.0:编写高质量iOS与OS X代码的52个有效方法    Objective-C编程之道:iOS设计模式解析 iOS应用逆向工程:分析与实战      重构:改善既有代码的设计         鸟哥的Linux私房菜  
    网站免责声明 网站地图 最新文章 用户隐私 版权申明
本站所有数据收集于网络,如果侵犯到您的权益,请联系网站进行下架处理。   

Copyright © 2018-2021   Powered By 网页学习体会    备案号:   粤ICP备20002247号