模块化编程的案例----------软件工程项目例子
模块: 多个.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\n", paper1.color);
while (1);
return 0;
}

一勤天下无难事。

浙公网安备 33010602011771号