先給你一個初步的模型,看自己能不能把後續的完成了,不行再説。
程序代码:
#include <iostream> #include <cstdlib> #include <vector> #include <conio.h> const size_t Max_Size = 100; struct PinInfo { char PinName[Max_Size]; char PinPoF[1]; float LO_LIMIT; float HI_LIMIT; float LO_SPEC; float HI_SPEC; float PinResult; char UNITS[1]; }; struct BIN { short int SoftBin; short int HwardBin; }; struct IC { std::vector<PinInfo> ICData; char ItemType[1]; int PinNum; int PinTestTime; int ICNumber; short int X; short int Y; }; struct Site { std::vector<IC> SiteData; std::vector<BIN> SiteBin; char SubTestName[Max_Size]; }; struct SubTest { std::vector<Site> SubTestData; }; struct Flow { std::vector<SubTest>* FlowData; }; void Pause(const char* message); int main(int argc, char* argv[]) { std::vector<Flow>* ProjectD = new std::vector<Flow>(2); std::cout << ProjectD->size() << std::endl; for each (Flow p in *ProjectD) { p.FlowData = new std::vector<SubTest>(10); std::cout << p.FlowData->size() << std::endl; } Pause("Press any key to continue..."); return EXIT_SUCCESS; } void Pause(const char* message) { if (message == NULL) { message = "Press any key to continue..."; } std::cout << std::endl << message; _getch(); } /* void InitFlowStruct(Flow *Project)//从这开始就不会了.. { Project->FlowData = new SubTest*[SubCount]; for(int i=0;i<FlowCount;i++) { FlowData[i] = new SubTest[SubCount]; //InitSubTestStruct(Project->FlowData); } Project->FlowNumber = 0 ; } void main(int argc, char* argv[]) { Flow **ProjectD = new Flow*[FlowCount]; for(int i=0;i<FlowCount;i++) { ProjectD[i] = new Flow[FlowCount]; InitFlowStruct(ProjectD[i]); } } */
授人以渔,不授人以鱼。