• 模块化编程的案例----------软件工程项目例子


                                                                    模块:  多个.c和.h  构成一个软件系  统   软件工程项目

    #ifndef __TEST_STRUCT_H
    #define __TEST_STRUCT_H
    
    
    struct toilet_paper
    {
    	int g_status;
    	int color;
    	int size;
    	int shape;
    	int operating_time;
    	void(*getPaper)(void);
    	void(*getPaperSize)(void);
    };
    
    extern struct toilet_paper paper1;
    
    
    #endif 
    

      

    // structural_value.cpp : 定义控制台应用程序的入口点。
    //
    
    #include "stdafx.h"
    static int color; static void getPaper(void) { } static void getPaperSize(void) {
    }
    struct toilet_paper paper1 { 1, color, 1, 1, 1, getPaper, getPaperSize };
    #ifndef __COMMON_H
    #define __COMMON_H 
    
    #include<stdio.h>
    #include "test_struct.h"
    
    
    #endif 




    #include "stdafx.h"
    
    int main()
    {
    
    	printf("paper1.color is %d
    ", paper1.color);
    	while (1);
    
    	return 0;
    }
    

      

    一勤天下无难事。
  • 相关阅读:
    第一个java程序和注释
    hadoop map端join
    hadoop wordcount入门
    hadoop reduce端联结
    hadoop streaming的使用
    HDU5752 Sqrt Bo
    L2-008 manacher 的应用
    L3-001 凑零钱
    L2-001 紧急救援
    如何在ubuntu下安装go开发环境
  • 原文地址:https://www.cnblogs.com/nowroot/p/12580983.html
Copyright © 2020-2023  润新知