當前位置:首頁 » 編程語言 » c語言銀行登錄頁面程序
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

c語言銀行登錄頁面程序

發布時間: 2022-04-17 10:13:03

c語言編寫一個用戶登陸的程序

代碼如下:

#include<stdio.h>

#pragma warning(disable:4996)

#include<string.h>

int main()

{

int i = 0;

char password[10] = { 0 };

printf("請輸入密碼:");

while (i < 3)

{

scanf("%s", password);

printf(" ");

if (strcmp(password, "972816") == 0)

{

printf("登錄成功 ");

break;

}

else

{

i++;

if (i != 3)

printf("再輸入一次");

}

}

if (i == 3)

printf("密碼錯誤三次退出登錄界面 ");

system("pause");

return 0;

(1)c語言銀行登錄頁面程序擴展閱讀:

#include後面有兩種方式,<>;和""前者先在標准庫中查找,查找不到在path中查找。後者為文件路徑,若直接是文件名則在項目根目錄下查找。

引用方法:#include<stdio.h>

注意事項:在TC2.0中,允許不引用此頭文件而直接調用其中的函數,但這種做法是不標準的。也不建議這樣做。以避免出現在其他IDE中無法編譯或執行的問題。

Ⅱ 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);
}
}
打字不易,如滿意,望採納。

Ⅲ 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);
}
}

Ⅳ c語言銀行管理系統初學者,求代碼不要太難,簡單寫一下代碼

if (codeInput != code) {
printf("wrong input, try again");
InputCode();
}
else {
login();
}

Ⅳ c語言編寫用戶登錄程序

代碼如下:

#include<stdio.h>

#pragma warning(disable:4996)

#include<string.h>

int main()

{

int i = 0;

char password[10] = { 0 };

printf("請輸入密碼:");

while (i < 3)

{

scanf("%s", password);

printf(" ");

if (strcmp(password, "972816") == 0)

{

printf("登錄成功 ");

break;

}

else

{

i++;

if (i != 3)

printf("再輸入一次");

}

}

if (i == 3)

printf("密碼錯誤三次退出登錄界面 ");

system("pause");

return 0;

(5)c語言銀行登錄頁面程序擴展閱讀:

#include後面有兩種方式,<>;和""前者先在標准庫中查找,查找不到在path中查找。後者為文件路徑,若直接是文件名則在項目根目錄下查找。

引用方法:#include<stdio.h>

注意事項:在TC2.0中,允許不引用此頭文件而直接調用其中的函數,但這種做法是不標準的。也不建議這樣做。以避免出現在其他IDE中無法編譯或執行的問題。

Ⅵ 怎麼用C語言編寫簡單的登錄程序

#include <stdio.h> int main() { int i, a=1234567890, b; for(i=0;;) { printf("輸入密碼:"); scanf("%d",&b); if(b==a) { printf("密碼正確!\n"); break; } else { prinf("密碼錯誤,重新輸入!\n\n"); i++; } } return 0; }

Ⅶ C語言編寫用戶登錄程序

艾達的小刀
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

/*隨機碼產生函數*/
void RandomCode (char Rcode[])
{
int i;
srand ((unsigned int)time(NULL));
for (i = 0; i < 3; ++i)
Rcode[i] = rand()%10 + '0';
Rcode[i] = '\0';
}
/*登陸函數,判斷信息是否匹配,若匹配返回1,否則返回0*/
int LandedApp (char *password[], char Rcode[])
{
char name[10] = {0};
char pword[10] = {0};
char rcode[4] = {0};

printf ("用戶名 : ");
gets (name);
printf ("密碼 : ");
gets (pword);
printf ("隨機碼 : ");
gets (rcode);

if (strcmp (name, password[0]) != 0 || strcmp (pword, password[1]) != 0 || strcmp (rcode, Rcode) != 0)
return 0;
else
return 1;
}

int main ()
{
char * password[2] = {"admin", "admin123"}; //用戶名和密碼
char rc[4] = {0}; //隨機碼
int count = 3; //可輸入次數

puts ("請輸入用戶名,密碼和隨機碼:");
while (count)
{
RandomCode (rc);
printf ("隨機碼 : %s\n", rc);
if (LandedApp(password, rc) != 0)
break;
--count;
if (count != 0)
puts ("錯誤的用戶名或密碼或隨機碼,請重新輸入: ");
}
if (count != 0)
puts ("\n成功登陸!");
else
puts ("\n登錄失敗 !");

return 0;
}
艾達的小刀

Ⅷ 用c語言模擬銀行賬號密碼登錄,那個大神可以指導一下

#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>

intchcode(){
charpw[50],ch;
char*syspw="abc";//原始密碼
inti,m=0;
printf("請輸入密碼:");
while(m<3){
i=0;
while((ch=_getch())!=' '){
if(ch==''&&i>0){
printf("");
--i;
}
elseif(ch!=''){
pw[i++]=ch;
printf("*");
}
}
pw[i]='';
printf(" ");
if(strcmp(pw,syspw)!=0){
printf("密碼錯誤,請重新輸入! ");
m++;
}
else{
printf("密碼正確! ");
system("pause");
return1;
}
}
printf("連續3次輸入錯誤,退出! ");
system("pause");
return0;
}

intmain(){
intlogin=chcode();
if(login)printf("登錄成功! ");
elseprintf("登錄失敗! ");
return0;
}

Ⅸ 用C語言編程 Bank Card(銀行卡系統)

http://wenku..com/view/b19dc34ffe4733687e21aa87.html
參考

Ⅹ c語言銀行程序

#include<math.h>
#include<stdio.h>
main(){
int a,c,d,e;
float b=10000;
int f;
int num=1;
printf("\t\t\t CHNIA BANK ATM\nplease input your secret code:\n");
scanf("%d",&a);
if(a==num){
printf(" welcome you to use your count,you have %.2f RMB!\n",b);

printf(" how much money do you want? please input the numbers: ");
scanf("%d",&e);
printf("\n");
c=b-e;
printf(" you till have : %d ,please choose exit or choose function ! \n",c);
scanf("%c",&d);
printf("\n");
}
else if(a!=num){
printf("your secret code is wrong,please input the correct secret code!\n");
}

printf("\t\t \tHELLO,WELCOME TO USE ATM\nplease choose you want function\n");
printf("\n\n");
printf("\t\t-----------------------------------\n");
printf("\t\t|\t\t|\t\t |\n");
printf("\t\t| 1. check\t| 2. withdraw money\t |\n");
printf("\t\t|\t\t|\t\t |\n");
printf("\t\t-----------------------------------\n");
printf("\t\t|\t\t|\t\t |\n");
printf("\t\t| 3. transfer account\t| 4. midify secret code|\n");
printf("\t\t|\t\t|\t\t |\n");
printf("\t\t-----------------------------------\n");
printf("\t\t|\t\t\t\t |\n");
printf("\t\t|\t 0. exit \t\t |\n");
printf("\t\t|\t\t\t\t |\n");
printf("\t\t-----------------------------------\n");
printf("please choose function:\n ");
scanf("%d",&f);
switch(f)
{ case 0:printf("exit");break;
case 1:printf("check");break;
case 2:printf("withdraw money");break;
case 3:printf("transfer account");break;
case 4:printf("midify secret code");break;

default :printf("it's wrong,please choose in 0~4!");
}

getch();
}