zoukankan      html  css  js  c++  java
  • 程序里面用的最多的数据结构之一集合数据结构

                                                                       这个是最常用的数据结构,也就是说的封装。                                                            

    digraph collectstruct{

    deviceName;

    toolName;

    gameName;

    muralName;

    };

                       

    //   集合结构 : 缺点对数据的访问不能使用 for循环,只能一个个通过名字取得到数据

    #include <windows.h>
    #include <stdio.h>
    
    
    // 下面可以想象我家的房间的样子
    // 我的家结构   内存是立体的
    struct Aggregation_DataStruct
    {
        char* deviceName;
    
        char* toolName;
    
        char* gameName;
    
        char* muralName;
    
    };
    
    static struct Aggregation_DataStruct DataStuct_Aggregation = 
    {
        .deviceName  = "手机",
        .toolName    = "风扇",
        .gameName    = "穿越火线",
        .muralName   = "奥黛丽赫本"
    };
    
    
    int main() {
    
    
        //while (1) 
        {
             //集合结构  离散结构 不能使用for循环  通过一个首地址取得的各个元素的内容
            for (int i = 0; i < 4; i++)
            {
                    printf("DataStuct_Aggregation  is %s\n", ((DataStuct_Aggregation.deviceName+i)));
    
            }
    
            //只能下面操作
            printf("deviceName is %s\n", DataStuct_Aggregation.deviceName);
            printf("toolName  is %s\n", DataStuct_Aggregation.toolName);
            printf("toolName  is %s\n", DataStuct_Aggregation.gameName);
            printf("muralName is %s\n", DataStuct_Aggregation.muralName);
            
        }
    
        while(1);
    }

    一勤天下无难事。
  • 相关阅读:
    MySql基础-1
    ClearSilver模板编程概述_转
    ehcache memcache redis 三大缓存男高音_转
    memcached完全剖析--1. memcached的基础 _转
    小组的创建
    现代软件工程 第7-9章作业
    现代软件工程 第3~6章作业
    现代软件工程作业 第二章 Github的使用
    现代软件工程作业-- GitHub的学习
    现代软件工程作业 GitHub的学习
  • 原文地址:https://www.cnblogs.com/nowroot/p/12444411.html
Copyright © 2011-2022 走看看