基于VC的滚动轴承信息录入与查询系统文档格式.docx
《基于VC的滚动轴承信息录入与查询系统文档格式.docx》由会员分享,可在线阅读,更多相关《基于VC的滚动轴承信息录入与查询系统文档格式.docx(21页珍藏版)》请在冰豆网上搜索。
![基于VC的滚动轴承信息录入与查询系统文档格式.docx](https://file1.bdocx.com/fileroot1/2022-11/15/5f5168de-cb01-4164-a2df-a67516a4a327/5f5168de-cb01-4164-a2df-a67516a4a3271.gif)
2.TheStructureofDesign
2.1Operationplatformanddevelopmentenvironment
ThisprocedureisintheMicrosoftVisualC++softwareplatformhascompiled,integrateddevelopmentenvironment,canprovidetheeditorClanguage,C++andC++/CLIprogramminglanguage.TheintegrationofVC++convenientdebuggingtools,especiallytheintegrationoftheMicrosoftWindowsprogramming(WindowsAPI),3DanimationDirectXAPI,Microsoft.NETframework.
2.2Systemstructure
Abovethesynthesisanalysisanddevelopmentfeaturesoftheplatform,Idecidedtoadoptthestructureofdatastructure,thebearingdesignforbasicinformationdatastructuredata,usedtostoremultiplebearinginformation,thebearinginsidediameter,outsidediameter,widthofmodels,suchasdataasthemembersofthestructure,soastorealizethecorrespondencebetweentheinputandoutputofinformation.
Figure2-1
3.Program
3.1Flowchart
Implementationofthisfunctionismainlyusestheswitchstatement.Thefirstprintffunctionintheoperationoftheinterfacetypebearinginquirysystemandfunctionalmoduleanditscorrespondingdigitaloption.Thenentertheoperationstobeperformedbytheswitchstatementoptions,judge,andthenintothedifferentfunctions,differentoperation.Ofcourse,toafteranoperationtocallthemenufunction,isconvenientforuserstocarryoutanoperationline.
3.2Thecontentsoftheprogram
VC++6.0environmentcompiler
Figure3-1
DetailedClanguageprogramasfollows
#defineN100
#include<
stdio.h>
/*头文件*/
string.h>
stdlib.h>
structbearing/*数据结构定义*/
{
charnum[5];
/*轴承型号*/
chard1[4];
/*内径*/
chard2[4];
/*外径*/
charb[4];
/*宽度*/
charda1[4];
/*damin*/
charda2[4];
/*Damax*/
charcr[5];
/*基本额定静载荷/kN*/
charnr[6];
/*极限转速/(r/min)油润滑*/
}bearings[N];
voidprintf_face()/*表头函数*/
printf("
轴承型号内径外径宽度daminDamax基本额定静载荷/kN极限转速/(r/min)油润滑\n"
);
}
/*输入模块*/
voidenter()
{
inti,n;
/*i是for循环里的循环变量。
n是轴承的数目*/
voidmenu();
/*申明主函数*/
voidinput(intk);
/*申明输入函数*/
voidsave(intk);
/*申明保存函数*/
要输入的轴承数量:
"
N-1);
scanf("
%d"
&
n);
/*要输入轴承信息的数目*/
\n输入轴承信息资料\n\n"
for(i=0;
i<
n;
i++)
{
\n输入第%d个轴承信息资料.\n"
i+1);
input(i);
/*输入函数*/
}
if(i!
=0)save(n);
/*保存函数*/
按任何键返回\n"
getchar();
/*返回*/
menu();
voidinput(inti)/*输入函数*/
printf_face();
%s%s%s%s%s%s%s%s"
bearings[i].num,bearings[i].d1,bearings[i].d2,bearings[i].b,bearings[i].da1,bearings[i].da2,bearings[i].cr,bearings[i].nr);
voidsave(intn)/*保存函数*/
FILE*fp;
inti;
if((fp=fopen("
bearing.txt"
"
wb"
))==NULL)
\未录入此型号轴承\n"
if(fwrite(&
bearings[i],sizeof(structbearing),1,fp)!
=1)
输入错误\n"
fclose(fp);
/*浏览模块*/
voidbrowse()
intk;
/*表示文件中有k种轴承*/
intload();
/*申明打开文件函数*/
voidprintf_bearings(intn);
/*申明输出函数(包含表头)*/
k=load();
printf_bearings(k);
/*输出k种轴承信息(包含表头)*/
voidprintf_one(inti)/*输出函数*/
printf("
%5s%5s%5s%5s%5s%5s%5s%5s"
\n\n"
voidprintf_bearings(intn)/*输出函数(包含表头)*/
intj;
for(j=0;
j<
j++)
printf_one(j);
intload()/*打开文件函数*/
rb"
\n未录入此型号轴承\n"
return0;
!
feof(fp);
fread(&
bearings[i],sizeof(structbearing),1,fp);
return(i-1);
voidsearch_by_d1()
structbearings;
intn,i,k=0;
voidprintf_one(inti);
n=load();
请输入内径:
"
%s"
s.d1);
printf_face();
if(strcmp(s.d1,bearings[i].d1)==0)
printf_one(i);
k=1;
if(k==0)printf("
\n未录入此型号轴承!
\n"
voidsearch_by_d2()
请输入外径:
s.d2);
if(strcmp(s.d2,bearings[i].d2)==0)
voidsearch_by_num()
请输入轴承型号:
s.num);
printf