#include
#include
#include "光标定位调用函数模块.c"
#include "密码加密.c"
//extern void gotoxy(int x,int y);
int main(void)
//void yhdl()
{
int js,cs=3,sz;
long name;
char mima[7];
while(1)
{
system("cls");
printf("\t\t\t\t***龙腾银行***\n");
printf("--------------------------------------------------------------------------------");
printf(" |用户登录| ");
printf("* * * * * * * * * * * * * *-----------------------* * * * * * * * * * * * * * * ");
printf("* * * * * * * * * * * * * *|账号: |* * * * * * * * * * * * * * * ");
printf("* * * * * * * * * * * * * *|密码: |* * * * * * * * * * * * * * * ");
printf("* * * * * * * * * * * * * *-----------------------* * * * * * * * * * * * * * * ");
printf("--------------------------------------------------------------------------------");
printf(" 系统消息提示 ");
printf(" ------------------------------ ");
printf(" | | ");
printf(" | | ");
printf(" | | ");
printf(" | | ");
printf(" ------------------------------ ");
gotoxy(34,5);
scanf("%d",&name);
gotoxy(34,6);
js=samima(sz);
sz=js;
if(name==85127779)
{
if(sz==100861)
{
gotoxy(25,11);
printf("恭喜你成功进入\n");
//jdt();
//yhglzx01();
break;
}
else
{
printf("\a\a\a");
gotoxy(25,11);
printf("警告:对不起你所输入的账号或");
gotoxy(30,12);
printf("密码不正确,请核实后再输");
gotoxy(30,13);
printf("入!");
gotoxy(30,17);
break;
}
}
if(name==110120)
{
if(sz==110110)
{
gotoxy(25,11);
printf("恭喜你成功进入\n");
//jdt();
//yhglzx02();
break;
}
else
{
printf("\a\a\a");
gotoxy(25,11);
printf("警告:对不起你所输入的账号或");
gotoxy(30,12);
printf("密码不正确,请核实后再输");
gotoxy(30,13);
printf("入!");
gotoxy(30,17);
break;
}
}
if(name=66668888)
{
}
else
{
printf("\a\a\a");
gotoxy(25,11);
printf("警告:对不起你所输入的账号或");
gotoxy(30,12);
printf("密码不正确,请核实后再输");
gotoxy(30,13);
printf("入!");
gotoxy(30,17);
system("pause>null&&cls");
}
}
}
光标函数的代码
//光标定位模块
//gotoxy(43,8);X代表横坐标,y代表纵坐标
void gotoxy(int x,int y)
//extern void gotoxy(int x,int y)
{
COORD c;
c.X=x-1;
c.Y=y-1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c);
}
密码加密函数的代码
//#include
//#include
//#include
//#include
//#include
//int main(void)
int samima(int x)
{
int k=0,sss;
char ls,mima[20];
//printf("输入密码:");
while((ls=getch())!='\r')
{
if(ls==8)
{
printf("\b");
printf(" ");
printf("\b");
}
if(!isdigit(ls))
{
continue;
}
printf("*");
mima[k++]=ls;
}
sss=atoi(mima);
x=sss;
//printf("%d",sss);
return x;
}
问题是,输入帐号错误后不执行这一段代码,求大神解决!
else
{
printf("\a\a\a");
gotoxy(25,11);
printf("警告:对不起你所输入的账号或");
gotoxy(30,12);
printf("密码不正确,请核实后再输");
gotoxy(30,13);
printf("入!");
gotoxy(30,17);
system("pause>null&&cls");
}
if(name=66668888)
应该是:
if(name==66668888)
如果对您有帮助,请采纳答案好吗,谢谢!
name = 66668888 赋值语句必然为真,所以永远也进不去else,所以一般的写法是吧 常量放在前边,这样即便你失误少些一个=,编译器也会告诉你。