1. c語言程序設計 超市商品信息管理系統
假設某超市經營各種商品,每種商品包括以下信息:商品編號、商品名稱、商品品牌、庫存數量、售價、已售數量。系統的主要功能包括:1. 創建商品信息文件:根據提示輸入若干商品的信息,並將信息保存至一個文件中。2. 商品進貨管理:每次購入新商品,需按要求輸入商品所含各項信息並存入商品信息文件中。如果已經存在該商品(以商品編號為准),則修改相應的庫存數量信息,否則生成新的商品信息記錄。3. 商品銷售管理:每次有商品銷售出去,則按要求輸入商品編號和商品名稱信息,並修改相應的商品信息文件。注意:商品銷售時要檢查庫存數量的合法性(即銷售出去的數量必須小於庫存數量)。4. 按不同條件進行查詢操作,輸出滿足條件的商品信息。(1) 輸入商品名稱,在商品信息文件中查找相應的商品信息並輸出。(2) 輸入商品品牌,在商品信息文件中查找該品牌的所有信息並輸出。5. 按不同條件對商品信息進行統計工作。(1) 輸入商品名稱,在商品信息文件中統計該商品的銷售總額。(2) 設置一個庫存數量警戒值,輸出庫存數量小於該警戒值的所有庫存商品的信息。(3) 輸入商品品牌,在商品信息文件中統計其不同商品名稱的庫存量,並輸出庫存量最高的那個商品的信息。
2. C語言做個小型商品銷售管理系統
我這里有一個!
具體的,稍微改一下就可以了!
#include "stdio.h" /*I/O函數*/
#include "stdlib.h" /*其它說明*/
#include "string.h" /*字元串函數*/
#include "conio.h" /*屏幕操作函數*/
#include "mem.h" /*內存操作函數*/
#include "ctype.h" /*字元操作函數*/
#include "alloc.h" /*動態地址分配函數*/
struct score
{
int mingci;
char xuehao[8];
char mingzi[20];
float score[6];
}data,info[1000];
int i,j,k=0;
char temp[20],ch;
FILE *fp,*fp1;
void shuru()
{
if((fp=fopen("s_score.txt","ab+"))==NULL)
{
printf("cannot open this file.\n");
getch();exit(0);
}
for(i=0;i<=1000;i++)
{
printf("\nPlease shuru xuehao:");
gets(data.xuehao);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score[2]=atof(temp);
printf("Please shuru wuli score:");
gets(temp);data.score[3]=atof(temp);
printf("Please shur huaxue score:");
gets(temp);data.score[4]=atof(temp);
data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];
fwrite(&data,sizeof(data),1,fp);
printf("another?y/n");
ch=getch();
if(ch=='n'||ch=='N')
break;
} fclose(fp);
}
void xianshi()
{
float s;int n;
if((fp=fopen("s_score.txt","rb+"))==NULL)
{
printf("Cannot reading this file.\n");
exit(0);
}
for(i=0;i<=1000;i++)
{
if((fread(&info[i],sizeof(info[i]),1,fp))!=1)
break;
}
printf("\nxuehao mingzi yuwen shuxue yingyu wuli huauxue zhongfen\n");
for(j=0,k=1;j<i;j++,k++)
{
info[j].mingci=k;
printf("%6s %8s %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f\n",info[j].xuehao,info[j].mingzi,info[j].score[0],info[j].score[1],info[j].score[2],info[j].score[3],info[j].score[4],
info[j].score[5]);
}
getch();
fclose(fp);
}
void xiugai()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("Cannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xiugai xuehao:");
scanf("%d",&i); getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{
printf("xuehao:%s\nmingzi:%s\n",data.xuehao,data.mingzi);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score[2]=atof(temp);
printf("Please input wuli score:");
gets(temp);data.score[3]=atof(temp);
printf("Please input huaxue score:");
gets(temp);data.score[4]=atof(temp);
data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];
} fwrite(&data,sizeof(data),1,fp1);
}
fseek(fp,0L,0);
fseek(fp1,0L,0);
while((fread(&data,sizeof(data),1,fp1))==1)
{
fwrite(&data,sizeof(data),1,fp);
}
fclose(fp);
fclose(fp1);
}
void chazhao()
{
if((fp=fopen("s_score.txt","rb"))==NULL)
{
printf("\nCannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xuehao chakan:");
scanf("%d",&i);
while(fread(&data,sizeof(data),1,fp)==1)
{
j=atoi(data.xuehao);
if(i==j)
{
printf("xuehao:%s mingzi:%s\nyuwen:%f\n shuxue:%f\n yingyu:%f\n wuli:%f\n huaxue:%f\n ",data.xuehao,data.mingzi,data.score[0],data.score[1],data.score[2],data.score[3],data.score[4],data.score[5]);
}getch();
}
}
void shanchu()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("\nopen score.txt was failed!");
getch();
exit(0);
}
printf("\nPlease input ID which you want to del:");
scanf("%d",&i);getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{
printf("Anykey will delet it.\n");
getch();
continue;
}
fwrite(&data,sizeof(data),1,fp1);
}
fclose(fp);
fclose(fp1);
remove("s_score.txt");
rename("temp.txt","s_score.txt");
printf("Data delet was succesful!\n");
printf("Anykey will return to main.");
getch();
}
main()
{
while(1)
{
clrscr(); /*清屏幕*/
gotoxy(1,1); /*移動游標*/
textcolor(YELLOW); /*設置文本顯示顏色為黃色*/
textbackground(BLUE); /*設置背景顏色為藍色*/
window(1,1,99,99); /* 製作顯示菜單的窗口,大小根據菜單條數設計*/
clrscr();
printf("*************welcome to use student manage******************\n");
printf("*************************menu********************************\n");
printf("* ========================================================= * \n");
printf("* 1>shuru 2>xiugai * \n");
printf("* 3>shanchu 4>chazhao * \n");
printf("* 5>xianshi 6>exit * \n");
printf("* * \n");
printf("* --------------------------------------------------------- * \n");
printf(" Please input which you want(1-6):");
ch=getch();
switch(ch)
{
case '1':shuru();break;
case '2':xiugai(); break;
case '3':shanchu(); break;
case '4':chazhao(); break;
case '5':xianshi(); break;
case '6':exit(0);
default: continue;
}
}
}
3. 用c語言實現超市商品管理系統,用指針實現商品的插入、刪除操作。
可以用鏈表,大致就是,你創建一個結構體,結構體里有商品的一些信息,然後關鍵的是有個該結構體的指針,這個指針是指向下一個商品的結構體地址的,依次類推,直到最後一個商品的指針是指向null的,然後開始插入商品的思路:①創建新商品的信息②先讓你要插入的結構體的指針指向要插入的那個位置後邊的地址,③然後插入位置的前面的結構體指向要插入商品④如果是插在末尾,或者開頭,你就注意是誰指向誰的問題。刪除商品思路:直接修改要刪除的商品之前的指針,繞過要刪除的商品,指向下一個不擅長的商品就ok。
structbook
{
longbook_number;//記錄書的編號
charbook_name[N];//儲存書的名字
doublebook_price;//記錄書的價格
charbook_author[N];//記錄書的作者
charbook_state[N];//記錄書的借還狀態
intbook_num;//記錄書的數量
charborrower_name[N];//記錄借書人姓名
charborrower_sex[M];//記錄借書人性別
longborrower_number;//記錄借書人學號
structbook*book_next;//指向下一個結構體
};//以前寫的圖書管理系統作為鏈表元素的結構體,只要關注最後一個指針就好了
BOOK*DelBook(BOOK*book_head)/*此函數負責刪除圖書*//*思路為連續讀取文件內容,找到要刪除的文件內容的位置,寫入一份新的文件,再替換掉舊文件*/
{
longnum;//記錄書籍號
intflag=0;//控制開關
charch;//記錄用戶的選擇
BOOK*p=book_head;
BOOK*pr=NULL;
printf(" 功能:刪除一本圖書的所有信息 ");
printf("輸入你要刪除的書籍號");
scanf("%ld",&num);
read_book_file(book_head);//將圖書信息寫入節點
while(num!=p->book_number&&p->book_next!=NULL)//查找節點並顯示節點內容並且記錄節點的地址
{
pr=p;
p=p->book_next;
}
if(book_head==NULL)/*數據不能正常獲取*/
{
exit(0);
}
elseif(num=p->book_num)/*找到了對應的*/
{
PrintBook(p);
printf("你確定要刪除么?");
scanf("%c",&ch);
if(ch=='y'||ch=='Y')
{
while(!flag)
{
if(book_head==NULL)
{
printf("鏈表為空 ");
returnbook_head;
}
if(p==book_head)//如果是頭節點要刪除
{
book_head=p->book_next;
free(p);//釋放刪除節點
flag=1;
}
elseif(p->book_next==NULL)//如果是末節點
{
free(p);//釋放刪除的節點
p=pr;//改變p的指向
p->book_next==NULL;
flag=1;
}
else
{
pr->book_next=p->book_next;//刪除中間節點
free(p);//釋放刪除的節點
flag=1;
}
/*節點刪除結束*//*接下來將新的內容寫入文件,之前那些內容被覆蓋*/
save_book_file(book_head);//調用文件寫入函數重新寫入
//這樣直接就實現了內容的覆蓋,相當於刪除文本內容
returnbook_head;//最後返回頭節點
}
}
else/*未找到*/
{
fflush(stdin);
returnbook_head;
}
}
returnbook_head;
}
以前寫的令一個管理系統的一部分,將就著看吧,插入商品和這個差不多
4. 編寫一個c語言程序,模擬銀行帳戶交易管理系統
代碼呢?
有什麼問題QQ聯系吧,資料里有
5. c語言 商品管理系統
#include"stdio.h"
#include <conio.h>
#include <stdlib.h>
//#include"FILE.h"
typedef struct shangpin
{
char name[20];
int biaohao;
int shuliang;
double jiage;
}Node;
typedef struct list
{
Node data;
struct list *next;
}List ,*Slist;
void charu(Slist &s,Node x);
int caidan()
{
int i;
while(1)
{
system("cls");
printf("\n\t\t\t 商店銷售管理系統\n\n");
printf("\t\t **********************************************\n\n");
printf("\t\t 1--添加商品 2--出售商品\n\n");
printf("\t\t 3--刪除商品 4--顯示商品\n\n");
printf("\t\t 5--查找商品 0--退出系統\n\n");
printf("\t\t **********************************************\n\n");
printf("請選擇(0-5): ");
scanf("%d",&i);
if(i<6&&i>=0)break;
}
return i;
}
void chushihua(Slist &s)
{
Slist head=new List;
head->next=NULL;
s=head;
}
void tianjia(Slist &s)
{
Node x;
Slist r,p,q;
int i=0;
r=new List;
r->next=NULL;
q=p=s->next;
while(q)
{
i++;
q=q->next;
}
printf("請輸入商品名稱、數量以及價格: ");
scanf("%s%d%lf",x.name,&x.shuliang,&x.jiage);
x.biaohao=i+1;
r->data=x;
s->next=r;
r->next=p;
}
void chu(Slist &s)
{
FILE *cp;//定義文件指針
int i=0;
Node x;
if((cp=fopen("shangpin.txt","a+"))==NULL)//打開文件
{printf("文件打開失敗!");return ;}
fseek(cp,0L,SEEK_SET);//將文件指針移動到文件開頭
while(!feof(cp))
{
fscanf(cp,"%s%d%lf",x.name,&x.shuliang,&x.jiage);//讀取文件的內容
x.biaohao=++i;
charu(s,x);//把讀到的數據插入到鏈表上
}
fclose(cp);//關閉文件
}
void charu(Slist &s,Node x)
{
Slist r,p=s->next;
r=new List;
r->next=NULL;
r->data=x;
s->next=r;
r->next=p;
}
void xieru(Slist s)
{
FILE *cp;//同上
Slist p=s->next;
if((cp=fopen("shangpin.txt","w+"))==NULL)
{printf("文件打開失敗!");return ;}//同上
while(p)
{
fprintf(cp,"%s %d %.2lf ",p->data.name,p->data.shuliang,p->data.jiage);//寫入文件中,並且以空格隔開
p=p->next;
}
fclose(cp);//關閉文件
}
Slist chazhao(Slist s,int m)
{
Slist p=s->next;
if(p==0)return 0;
if(p->next==0)return p;
if(p->data.biaohao==m)return p;
while(p->next)
{
if(p->next->data.biaohao==m)return p;
p=p->next;
}
return 0;
}
void xianshi(Slist s)
{
Slist p;
p=s->next;
printf("%10s%20s%10s%10s\n","商品編號","商品名稱","商品數量","商品價格");
while(p)
{
printf("%10d%20s%10d%10.2f\n",p->data.biaohao,p->data.name,p->data.shuliang,p->data.jiage);
p=p->next;
}
}
void shanchu(Slist &s)
{
}
void chushou(Slist &s)
{
}
void main()
{
int num;
Slist s;
chushihua(s);
chu(s);
num=caidan();
while(1)
{
switch(num)
{
case 0:exit(0);break;
case 1:tianjia(s);break;
case 2:chushou(s);break;
case 3:shanchu(s);break;
case 4:xianshi(s);break;
case 5:chazhao(s,1);break;
}
printf("按任意鍵繼續!");
getch();
num=caidan();
}
xieru(s);
}
//有些函數我在沒寫啊,你自己寫寫吧,文件的讀取和寫入,還有鏈表的創建我都給你寫好了,也就是上面的1,4我都寫好了,
//包括了文件,剩下的2,3,5,你自己試試,並且我也給你寫了一個查找函數,你看看能用不!
6. C語言銀行管理系統
#include <conio.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
char cFile[] = "date.txt";
struct bank
{
char id[10+1];
char psw[6+1];
double money;
};
welcome1()
{
printf("\n\n\t\t歡迎使用虛擬銀行自動取款機服務!\t\t\n\n");
printf("請選擇功能:\n");
printf("\n=================================================\n");
printf(" || 請輸入序號 ||\n");
printf(" || 1.新用戶開戶。 ||\n");
printf(" || 2.老用戶登陸。 ||\n");
printf(" || 3.退出系統。 ||\n");
printf("=================================================\n");
}
welcome2()
{
printf("\n\n\t\t注冊須知\n\n");
printf("**************************************************\n");
printf("* 1.請填寫您的真實資料! *\n");
printf("* 2.開戶首期必須存入100元以上 *\n");
printf("**************************************************\n");
}
welcome3()
{
printf("\n\n\t\t\3 歡迎進入虛擬銀行系統 \3\n\n");
printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\n");
printf("\1\1\t 請選擇功能:1.取款(最多透資2000); \1\1\n");
printf("\1\1\t 2.存款; \1\1\n");
printf("\1\1\t 3.查詢余額; \1\1\n");
printf("\1\1\t 4.修改密碼; \1\1\n");
printf("\1\1\t 5.返回主頁面; \1\1\n");
printf("\1\1\t 任意鍵退出. \1\1\n");
printf("\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\n");
}
int search(char* user, char* pwd, char* real_pwd)/*判斷帳號是否相同,不相同返回1*/
{
FILE* file;
char user_buff[256], pwd_buff[256];
file = fopen(cFile, "r");
if (!file) return 0;
while (!feof(file))
{
if (fscanf(file, "%s%s\n", user_buff, pwd_buff) == EOF) return 0;
if (!strcmp(user_buff, user))
{
if (real_pwd) strcpy(real_pwd, pwd_buff);
return 1;
}
}
fclose(file);
return 0;
}
int add(char* user, char* pwd, double coin_n)
{
FILE* file;
file = fopen(cFile, "a");
if (!file) return 0;
fprintf(file, "%s %s %.2lf\n", user, pwd, coin_n);
fclose(file);
return 0;
}
int wenjian(char* user, char* pwd,double coin)
{
if (search(user, pwd, NULL)) return 0;
else add(user, pwd, coin);
return 1;
}
zhuce()/*注冊*/
{
struct bank *p;
int i=0,k=0,judge1,judge2;
char name[30];
char sex,ch;
char sh[18];
int n;
p=(struct bank*)malloc(sizeof(struct bank));/*給p分配內存*/
welcome2();
printf("請輸入您的名字(純英文):");
gets(name);
printf("請輸入您的性別(男:1 女2):");
fflush(stdin);
scanf("%c",&sex);
fflush(stdin);
printf("請輸入您的身份證號碼:");
gets(sh);
for(n=0;n<strlen(name);n++)/*判斷輸入信息是否正確*/
{
if(name[n]>='0'&&name[n]<='9')
{
printf("您輸入的名字有誤!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
}
if(sex!='1'&&sex!='2')/*判斷輸入信息是否正確*/
{
printf("您輸入的性別不對!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
if(strlen(sh)!=18)/*判斷輸入信息是否正確*/
{
printf("您輸入的身份證號碼不全!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
for(n=0;n<strlen(sh)-1;n++)/*判斷輸入信息是否正確*/
{
if(sh[n]<48||sh[n]>57)
{
printf("您輸入的身份證號碼非法!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
else
{
if(sh[18]!='x'&&sh[18]<48&&sh[18]>57)
{
printf("您輸入的身份證號碼非法!\n");
printf("\n請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
}
}
printf("請輸入您的帳號(10位純數字):\n");
fflush(stdin);
scanf("%s",p->id);
fflush(stdin);
while(i <strlen(p->id))
{
if((p->id[i] < 48) || (p->id[i] > 57))
{
judge1=0;
}
i++;
}
while(strlen(p->id)!=10 ||judge1==0)/*判斷帳號的正確性*/
{
printf("您輸入的帳號不正確,必須為10位純數字!");
printf("請重新輸入(10位純數字):");
fflush(stdin);
scanf("%s",p->id);
fflush(stdin);
}
printf("請輸入您的密碼(6位純數字):\n");
fflush(stdin);
scanf("%s",p->psw);
fflush(stdin);
while(k <strlen(p->psw))
{
if((p->psw[k] < 48) || (p->psw[k] > 57))
{
judge2=0;
}
k++;
}
while(strlen(p->psw)!=6 ||judge2==0)/*判斷密碼形式的正確性*/
{
printf("您輸入不正確!密碼必須為6位純數字!\n");
printf("請重新輸入密碼(6位純數字):");
fflush(stdin);
scanf("%s",p->psw);
fflush(stdin);
}
printf("請輸入您的首期存款:");
fflush(stdin);
scanf("%lf",&p->money);
fflush(stdin);
while((p->money)<100)
{
printf("您必須存入100元以上,請重新輸入:");
fflush(stdin);
scanf("%lf",&p->money);
fflush(stdin);
}
if (wenjian(p->id,p->psw,p->money))/*存入文件並輸出基本信息*/
{
system("cls");
printf("注冊成功!");
printf("您的注冊信息如下,請牢記:\n");
printf("名字:");
puts(name);
printf("性別代碼:%c\n",sex);
printf("身份證號碼:");
puts(sh);
printf("帳號:");
puts(p->id);
printf("密碼:");
puts(p->psw);
printf("您帳戶里的余額為:%.2lf\n",p->money);
printf("請選擇:按1返回主頁面. 按任意鍵退出:");
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
else exit(0);
}
else/*如有相同帳號,注冊失敗*/
{
system("cls");
printf("您輸入的帳號已經存在!注冊失敗!\n");
printf("請選擇:按1返回主頁面. 按任意鍵退出:");
scanf("%c",&ch);
if(ch=='1'){system("cls");main();}
else exit(0);
}
}
gongneng(char Account[10+1],char Password[6+1],double Money)/*登陸成功後的功能界面*/
{
FILE *ps;
struct bank xin[1000];
int k=0,b=0;
char mima[6+1],Chiose,x;
char count[10+1],word[6+1];
double inmoney,outmoney,addmoney;
welcome3();
fflush(stdin);
scanf("%c",&Chiose);
fflush(stdin);
ps=fopen(cFile,"r");
if (!ps)
{
printf("不能打開文件!按任意鍵退出!");
fflush(stdin);
scanf("%c",&x);
fflush(stdin);
exit(0);
}
if(Chiose=='1')
{
printf("輸入您的取款金額:");
fflush(stdin);
scanf("%lf",&outmoney);
fflush(stdin);
while(!feof(ps))
{
fscanf(ps, "%s %s %lf",&xin[k].id,&xin[k].psw,&xin[k].money);
k++;
}
fclose(ps);
ps=fopen(cFile,"wb");
if (!ps)
{
printf("不能打開文件!按任意鍵退出!");
fflush(stdin);
scanf("%c",&x);
fflush(stdin);
exit(0);
}
while(!feof(ps))
{
//printf("%s %s %.2lf\n",xin[b].id,xin[b].psw,xin[b].money);
if ((strcmp(Account, xin[b].id)==0)&&(strcmp(Password, xin[b].psw)==0))
{
xin[b].money=xin[b].money-outmoney;
}
printf("%.2lf\n",xin[b].money);
fprintf(ps, "%s %s %.2lf\n", xin[b].id, xin[b].psw, xin[b].money);
b++;
}
}
}
denglu()/*登陸*/
{
FILE *fp;
char account[10+ 1],password[6 + 1],h;
int m=0;
char real_account[10+ 1]; /* 帳號緩存 */
char real_password[6 + 1]; /* 密碼緩存*/
double real_money_o=0.0; /*存款緩存*/
printf("請輸入您的帳號(10位純數字):");
gets(account);
printf("請輸入您的密碼(6位純數字):");
gets(password);
fp = fopen(cFile, "r");
if (!fp)
{
printf("不能打開文件!按任意鍵退出!");
fflush(stdin);
scanf("%c",&h);
fflush(stdin);
exit(0);
}
while (m<=2) /*判斷是否輸入錯3次了*/
{
while(fscanf(fp, "%s %s %lf", &real_account, &real_password,&real_money_o) != EOF) /*循環判斷帳號密碼*/
{
if ((strcmp(real_account, account)==0)&&(strcmp(real_password, password)==0))
{
system("cls");
printf("登陸成功!");
gongneng(real_account,real_password,real_money_o);
fclose(fp);
return 0;
}
}
rewind(fp); /*重新打開文件,進行新一輪的密碼驗證*/
printf("您輸入的帳號不存在或密碼不正確!\n請重新輸入:\n");
m++;
printf("請輸入您的帳號(10位純數字):");
fflush(stdin);
gets(account);
fflush(stdin);
printf("請輸入您的密碼(6位純數字):");
fflush(stdin);
gets(password);
fflush(stdin);
}
fclose(fp);
printf("您輸入帳號密碼不正確已經3次,您被強制退出系統(按任意鍵退出)!");
fflush(stdin);
scanf("%c",&h);
fflush(stdin);
exit(0);
}
int main()
{
char chiose;
welcome1();
scanf("%c",&chiose);
getchar();
if(chiose <='0' ||chiose>='4')
{
while(chiose <='0' || chiose>='4')
{
printf("您的輸入有誤,請重新輸入:");
scanf("%c",&chiose);
getchar();
}
}
if(chiose=='1')
{
system("cls");
zhuce();/*注冊*/
}
if(chiose=='2')
{
system("cls");
denglu();/*登陸*/
}
if(chiose=='3')
{
printf("謝謝您的使用!");
exit(0);
}
}
打字不易,如滿意,望採納。
7. 編寫一個c語言程序,模擬銀行帳戶交易管理系統。 寫好給20塊錢的分 或者q幣
http://..com/link?url=koYWtHTk-_IhrTRC90-
這地方有的啊