commit 50dedab51c4e25e96edd9cf44bb2616c0fca888d Author: 1037083422@qq.com <1037083422@qq.com> Date: Fri Jan 11 11:23:49 2019 +0800 first commit diff --git a/课程设计/1.c b/课程设计/1.c new file mode 100644 index 0000000..4f9e57e --- /dev/null +++ b/课程设计/1.c @@ -0,0 +1,516 @@ +#include +#include +#include +void xiugai() +{ + int i,num; //iѭnumswitchѡṹеж + char c[10]; //ݣ룩ַ + struct zhanghu //һzhanghuĽṹ + { + char name[10]; // + char mima[10]; // + char dizhi[10]; //ŵַ + char shouji[20]; //ֻ + long int money; //˻ + }; + struct zhanghu m[20],caozuo; // һmĽṹ飬һcaozuoĽṹ + FILE *fp; + if((fp=fopen("ݿ.txt","r"))==NULL) //ļ + { + printf("File open error!\n"); + exit(0); + } + printf("Ҫ޸Ϣ˻֣"); + scanf("%s",&(caozuo.name)); + printf("˻루6λ֣"); + scanf("%s",&(caozuo.mima)); + printf("ٴȷ룺"); + scanf("%s",&c); + for(i=0;i<20;i++) + { // ѭļеδŵṹm + fscanf(fp,"%s %s %s %s %ld",&(m[i].name),&(m[i].mima),&(m[i].dizhi),&(m[i].shouji),&(m[i].money)); + if(strcmp(m[i].name,caozuo.name)==0)// жϴ˴δļǷҪ޸ĵ + { + while((strcmp(c,caozuo.mima)!=0)||(strcmp(c,m[i].mima)!=0))//ѭֱ֤ļдһ²Žѭ + { + printf("룺\n"); + printf("루6λ֣"); + scanf("%s",&(caozuo.mima)); + printf("ٴȷ룺"); // 룬Ա֤Ϣ׼ȷ + scanf("%s",&c); + } + printf("밴ʾϢ\n"); + printf("밴'1'밴'2';\n"); //ʾ + printf("ַ밴'3'ϵʽ밴'4';\n"); + printf("֣"); + do // ѭĿǸݾ֣뵽numУִƵĸϢ + { + scanf("%d",&num); // ֣ѡִһָϢ + switch(num) // ѭ + { + case 1: // Ϊ1 + { + printf("滻"); + scanf("%s",&(caozuo.name)); + strcpy(m[i].name,caozuo.name); + break; + } + case 2: + { + printf("滻루6λ֣"); //Ϊ2 + scanf("%s",&(caozuo.mima)); + printf("ٴȷ룺"); + scanf("%s",&c); + while(strcmp(c,caozuo.mima)!=0) // ѭ֤׼ȷ + { + printf("벻һ£롣\n"); + printf("루6λ֣"); + scanf("%s",&(caozuo.mima)); + printf("ٴȷ룺"); + scanf("%s",&c); + } + strcpy(m[i].mima,caozuo.mima); //滻 + break; + } + case 3: + { + printf("滻ַ"); + scanf("%s",&(caozuo.dizhi)); //Ϊ3ĵַ + strcpy(m[i].dizhi,caozuo.dizhi); + break; + } + case 4: + { + printf("滻ϵʽ"); + scanf("%s",&(caozuo.dizhi)); //Ϊ4ϵʽ + strcpy(m[i].dizhi,caozuo.dizhi); + break; + } + } + printf("Ƿ޸Ϣ\n"); + printf("֣˳\n");//ʾ + scanf("%d",&num); + }while(num>=1&&num<5); // 14֮䣬ִѭϢѭֹ + } + } + if(fclose(fp)) + { // رļ + printf(" File close error! \n"); + exit(0); + } + if((fp=fopen("ݿ.txt","w"))==NULL) + { // ٴδļ + printf("File open error!\n"); + exit(0); + } + for(i=0;i<16;i++) + fprintf(fp,"%s %s %s %s %ld\n",(m[i].name),(m[i].mima),(m[i].dizhi),(m[i].shouji),(m[i].money)); + if(fclose(fp)) // Ѹĺдļ + { + printf(" File close error! \n"); + exit(0); + } + printf("ϢѸġ\n"); //ʾ +} +void shanchu() +{ + int i,a,l=0,f; // 弸ͱiѭ + char c[10]; + struct zhanghu + { + char name[10]; + char mima[10]; + char dizhi[10]; + char shouji[20]; + long int money; + }; + struct zhanghu m[20],shuru; // һṹmһshuruĽṹ + FILE *fp; + if((fp=fopen("ݿ.txt","r"))==NULL) + { + printf("File open error!\n"); + exit(0); + } + while((a=fgetc(fp))!=EOF) // ѭĿǰļ浽l + if(a=='\n') + l++; + if(fclose(fp)) + { + printf(" File close error! \n"); + exit(0); + } + if((fp=fopen("ݿ.txt","r"))==NULL) + { + printf("File open error!\n"); + exit(0); + } + + if((fp=fopen("ݿ.txt","r"))==NULL) + { + printf("File open error!\n"); + exit(0); + } + printf("Ҫɾ˻֣"); + scanf("%s",&(shuru.name)); + printf("˻루6λ֣"); + scanf("%s",&(shuru.mima)); + printf("ٴȷ룺"); // ʾ + scanf("%s",&c); + for(i=0;im[i].money) //жȡǷ񳬳˻ + { + printf("㣡֧ȡΧڵĽ\n"); + m[i].money=m[i].money-a; // ô˻ԭн + printf("ɹǰ˻Ϊ%ldԪ\n",m[i].money); + } + else + { + m[i].money=m[i].money-a; + printf("ɹǰ˻Ϊ%ldԪ\n",m[i].money); + } + } + } + if(fclose(fp)) + { + printf(" File close error! \n"); + exit(0); + } + if((fp=fopen("ݿ.txt","w"))==NULL) + { + printf("File open error!\n"); + exit(0); + } + for(i=0;i<16;i++)// mдļ + fprintf(fp,"%s %s %s %s %ld\n",(m[i].name),(m[i].mima),(m[i].dizhi),(m[i].shouji),(m[i].money)); + if(fclose(fp)) + { + printf(" File close error! \n"); + exit(0); + } +} +void charu() +{ + int i; // iѭ + char c[10]; //c洢 + struct zhanghu + { + char name[10]; + char mima[10]; + char dizhi[10]; + char shouji[20]; + long int money; + }; + struct zhanghu m[20];// ṹm + FILE *fp; + if((fp=fopen("ݿ.txt","r"))==NULL) + { + printf("File open error!\n"); + exit(0); + } + for(i=0;i<16;i++) // ѭļݶm + fscanf(fp,"%s %s %s %s %ld",&(m[i].name),&(m[i].mima),&(m[i].dizhi),&(m[i].shouji),&(m[i].money)); + printf("Ҫ˻֣"); + scanf("%s",&(m[16].name)); + printf("־ӵַ"); // ʾ + scanf("%s",&(m[16].dizhi)); + printf("ϵʽֻţ"); + scanf("%s",&(m[16].shouji)); + printf("루6λ֣"); + scanf("%s",&(m[16].mima)); + printf("ٴȷ룺"); + scanf("%s",&c); + while(strcmp(c,m[16].mima)!=0) // ѭ֤׼ȷ + { + printf("벻һ£롣\n"); + printf("루6λ֣"); + scanf("%s",&(m[16].mima)); + printf("ٴȷ룺"); + scanf("%s",&c); + } + printf("״\n"); + scanf("%ld",&(m[16].money)); + if(fclose(fp)) + { + printf(" File close error! \n"); + exit(0); + } + if((fp=fopen("ݿ.txt","w"))==NULL) + { + printf("File open error!\n"); + exit(0); + } + for(i=0;i<17;i++) // mдļ + fprintf(fp,"%s %s %s %s %ld\n",(m[i].name),(m[i].mima),(m[i].dizhi),(m[i].shouji),(m[i].money)); + if(fclose(fp)) + { + printf(" File close error! \n"); + exit(0); + } + printf("˻ѽ\n"); +} +void chaxun() +{ + struct zhanghu + { + char name[10]; + char mima[10]; + char dizhi[10]; + char shouji[20]; + char money[20]; + }; + struct zhanghu m,shuru; // ṹmļеݣshuru + FILE *fp; + if((fp=fopen("ݿ.txt","r+"))==NULL) + { + printf("File open error!\n"); + exit(0); + } + printf("Ҫѯ˻֣"); + scanf("%s",&(shuru.name)); + while(!feof(fp)) // ļδβʱ + { + fscanf(fp,"%s %s %s %s %s",&(m.name),&(m.mima),&(m.dizhi),&(m.shouji),&(m.money)); //ȡļ + if(strcmp(shuru.name,m.name)==0)//жǷmеһ + { + printf("ѯ루6λ֣"); + scanf("%s",&(shuru.mima)); + while(strcmp(m.mima,shuru.mima)!=0) // ѭ֤׼ȷ + { + printf("루6λ֣\n"); + scanf("%s",&(shuru.mima)); + } + printf("ǰ˻Ϊ%sԪ\n",(m.money)); + break; + } + } + if(fclose(fp)) + { + printf(" File close error! \n"); + exit(0); + } +} +int jianyan(int x) +{ + int n; + n=x; // nܴxе + if(n>=1&&n<=6) // жϣ0~6֮䣬򷵻صǰnֵ + return n; + else // Ҫnٷn־ + { + printf("ֲڲΧڣ\n"); + printf("֣\n"); + n=0; + scanf("%d",&n); + jianyan(n); + } +} +void caidan(int x) +{ + char c; + printf("ȷǷִ'%d'IJ\n",x); // ʾ + printf("ȷִ'Y'ȡִ'N'\n"); + scanf("%c",&c); + printf("ĸ"); + scanf("%c",&c); + if(c=='Y') // Ϊ'Y'ִswitchѭ + { + switch(x) // жxֵxִֵвͬcase + { + case 1: + { + chaxun(); + printf("Ƿ\n"); + break; // ִ굱ǰcaseֱswitchѭ + } + case 2: + { + cunkuan(); + printf("Ƿ\n"); + break; + } + case 3: + { + qukuan(); + printf("Ƿ\n"); + break; + } + case 4: + { + charu(); + printf("Ƿ\n"); + break; + } + case 5: + { + shanchu(); + printf("Ƿ\n"); + break; + } + case 6: + { + xiugai(); + printf("Ƿ\n"); + break; + } + } + } + if(c=='N') // Ϊ'N'ȡǰ + printf("'%d'ȡִУǷ\n",x); + printf("֣˳\n"); //ʾ + x=0; + printf("֣"); + scanf("%d",&x); + if(x==9) + exit(0); + if(x>=1&&x<=6) //1~6֮䣬ִcaidanе + caidan(x); +} +int main(void) +{ + int n,k; + printf("DZϵͳĻܣ\n"); //ʾ + printf("1.ѯ˻\n"); + printf("2.\n"); + printf("3.ȡ\n"); + printf("4.˻\n"); + printf("5.ɾ˻\n"); + printf("6.޸˻\n"); + printf("ݾҪֽز\n"); + printf("֣"); + scanf("%d",&n); + k=jianyan(n); //ȵjianyannǷڿɲķΧ + caidan(k); // ٵcaidan + return 0; +} + diff --git a/课程设计/Debug/1.obj b/课程设计/Debug/1.obj new file mode 100644 index 0000000..659de38 Binary files /dev/null and b/课程设计/Debug/1.obj differ diff --git a/课程设计/Debug/vc60.idb b/课程设计/Debug/vc60.idb new file mode 100644 index 0000000..da88360 Binary files /dev/null and b/课程设计/Debug/vc60.idb differ diff --git a/课程设计/Debug/vc60.pdb b/课程设计/Debug/vc60.pdb new file mode 100644 index 0000000..816aaf9 Binary files /dev/null and b/课程设计/Debug/vc60.pdb differ diff --git a/课程设计/Debug/课程设计.exe b/课程设计/Debug/课程设计.exe new file mode 100644 index 0000000..23513d7 Binary files /dev/null and b/课程设计/Debug/课程设计.exe differ diff --git a/课程设计/Debug/课程设计.ilk b/课程设计/Debug/课程设计.ilk new file mode 100644 index 0000000..880e504 Binary files /dev/null and b/课程设计/Debug/课程设计.ilk differ diff --git a/课程设计/Debug/课程设计.pch b/课程设计/Debug/课程设计.pch new file mode 100644 index 0000000..4811153 Binary files /dev/null and b/课程设计/Debug/课程设计.pch differ diff --git a/课程设计/Debug/课程设计.pdb b/课程设计/Debug/课程设计.pdb new file mode 100644 index 0000000..6dcb941 Binary files /dev/null and b/课程设计/Debug/课程设计.pdb differ diff --git a/课程设计/数据库.txt b/课程设计/数据库.txt new file mode 100644 index 0000000..992cdac --- /dev/null +++ b/课程设计/数据库.txt @@ -0,0 +1,16 @@ + 111111 · 1381111111 200000 +Ǯ 222222 · 1382222222 546545600 + 333333 · 1383333333 45647878 + 444444 · 1384444444 45687 + 555555 · 1385555555 7894256 + 666666 ŷ· 1386666666 1568 +֣ 777777 · 1387777777 644511 + 888888 · 1388888888 15458787 + 999999 · 1389999999 45621 + 158974 · 1384548788 544874 + 456564 · 1384564897 48451444 +κ 484789 ƽ· 1384878411 59794 +һ 448751 · 1384587845 47741454 +˼ 145844 · 1384547897 487752558 + 364683 ͨ· 1386247345 2175577 +ʱ 234757 ս· 1384578371 467562475 diff --git a/课程设计/课程设计.dsp b/课程设计/课程设计.dsp new file mode 100644 index 0000000..5c8bd0d --- /dev/null +++ b/课程设计/课程设计.dsp @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="γ" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=γ - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "γ.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "γ.mak" CFG="γ - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "γ - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "γ - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "γ - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x804 /d "NDEBUG" +# ADD RSC /l 0x804 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "γ - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x804 /d "_DEBUG" +# ADD RSC /l 0x804 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "γ - Win32 Release" +# Name "γ - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\1.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/课程设计/课程设计.dsw b/课程设计/课程设计.dsw new file mode 100644 index 0000000..ec80dd4 --- /dev/null +++ b/课程设计/课程设计.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "γ"=".\γ.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/课程设计/课程设计.ncb b/课程设计/课程设计.ncb new file mode 100644 index 0000000..b9c5b9e Binary files /dev/null and b/课程设计/课程设计.ncb differ diff --git a/课程设计/课程设计.opt b/课程设计/课程设计.opt new file mode 100644 index 0000000..a643013 Binary files /dev/null and b/课程设计/课程设计.opt differ diff --git a/课程设计/课程设计.plg b/课程设计/课程设计.plg new file mode 100644 index 0000000..0f453d4 --- /dev/null +++ b/课程设计/课程设计.plg @@ -0,0 +1,24 @@ + + +
+

Build Log

+

+--------------------Configuration: γ - Win32 Debug-------------------- +

+

Command Lines

+Creating temporary file "C:\Users\ADMINI~1\AppData\Local\Temp\RSPB782.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/γ.pdb" /debug /machine:I386 /out:"Debug/γ.exe" /pdbtype:sept +".\Debug\1.obj" +] +Creating command line "link.exe @C:\Users\ADMINI~1\AppData\Local\Temp\RSPB782.tmp" +

Output Window

+Linking... + + + +

Results

+γ.exe - 0 error(s), 0 warning(s) +
+ +