用C语言程序编写用户名密码 程序

作者&投稿:曹炭 (若有异议请与网页底部的电邮联系)
c语言程序设计 密码设置程序怎么编写???~

#include
#include
#include

int main(int argc,char *argv[])
{
const char user[]="wangpin";/*用户名自己可改动*/
const char password[]="wangpin@126";/*密码自己可改动*/
if(argc == 1)
{
printf("Input error! Usage:filename username password
");
getch();
exit(1);
}
else if(argc == 3)
{
if (strcmp(argv[1],user) != 0 || strcmp(argv[2],password) != 0)
{
printf("Input error: Invalid username or password
");
getch();
exit(1);
}
}
printf("Authentication Pass..
");
sound(500);/*最简单的音乐声*/
delay(50000);
nosound();
getch();
return 0;
}

先运行这个程序得到一个exe类型的可执行文件,然后可以复制到c盘根目录下,用桌面左下的图标进入:开始-程序-附件-命令提示符
然后键入 cd \
到c盘根目录下输入
exe文件名 wangpin wangpin@126
就是运行这个程序
------------------------------------------------------------------
------------------------------------------------------------------
下面是一个简单的音乐程序,你可以把它加到上面代替sound()到nosound()那一部分发出>音乐歌曲(小心!声音可能很大)
#include
#include
#include

int main(void)
{
int i,j;
int fr[]={392,392,440,294,262,262,220,294,392,392,
440,532,440,392,262,262,220,294,392,294,
262,247,220,196,392,294,330,294,262,262,
220,294,330,294,262,294,262,247,220,196};
int tim[]={4,2,2,8,4,2,2,8,4,4,2,2,2,2,4,2,2,8,4,
4,4,2,2,4,4,4,2,2,4,2,2,2,2,2,2,2,2,2,2,12};
for(i=0;i<40;i++)
{
sound(fr[i]);
delay(tim[i]*100000000);
nosound();
}
system("pause");
return 0;
}

艾达的小刀
#include
#include
#include
#include

/*随机码产生函数*/
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
", rc);
if (LandedApp(password, rc) != 0)
break;
--count;
if (count != 0)
puts ("错误的用户名或密码或随机码,请重新输入: ");
}
if (count != 0)
puts ("
成功登陆!");
else
puts ("
登录失败 !");

return 0;
}
艾达的小刀

#include<stdio.h>
#include<string.h>
void main()
{
int i,flag1,flag2;
char name[20]="lushan",password[10]="123456";
char person[20],password1[10];
for(i=0;i!=3;)
{
printf("Please input the name:\n");
gets(person);
flag1=strcmp(person,name);
printf("Please input the password:\n");
gets(password1);
flag2=strcmp(password,password1);
if(flag1==0&&flag2==0)
{
printf("Pass successfully!");
break;
}
else
{
printf("You have enter the wrong name or password!\n");
i++;
}
}
}

#include "stdio.h"
#include<string.h>
#include<bios.h>
main()
{
char code1[7];
char code2[7];
int i=0;
printf("please input password with six numbers:");
do{ code1[i]=bioskey(0);
printf("*");
}while(i++!=5);
code1[i]='\0';

printf("\n\nplease input password again:");
i=0;
do{ code2[i]=bioskey(0);
printf("*");
}while(i++!=5);

code2[i]='\0';
if(strcmp(code1,code2)==0) printf("\nYES");
else printf("\nerror");

getchar();

}

输入是3次的话自己加个循环哈;
呵呵


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("\\n");if (strcmp(password, "972816") == 0){ printf("登录成功\\n");break;} else...

c语言编写程序,模拟用户注册和登录的过程,实现用户的注册和登录_百度知 ...
else{ printf("用户名或密码错误!登录失败!\\n");} } return 0;}

C语言编写用户登录程序
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) != ...

用C语言程序编写用户名密码 程序
include<stdio.h> include<string.h> void main(){ int i,flag1,flag2;char name[20]="lushan",password[10]="123456";char person[20],password1[10];for(i=0;i!=3;){ printf("Please input the name:\\n");gets(person);flag1=strcmp(person,name);printf("Please input the passwo...

用C语言解决这一道题: 编写一个程序,首先要求用户输入名字,然后要求...
1、首先在Ubuntu的终端写出要实现的内容步骤,注释步骤可以帮助书写者理清思路。2、接下来我们运用Input方法,提示用户输入信息,input中的参数就是提示文字。3、接下来接收好用户输入的内容后,我们就可以运用用户输入的内容进行逻辑处理。4、下面我们运行程序,你会在界面中看到,终端提示你输入名字,不输入...

怎么用c语言写一个创建用户名和密码并且能修改密码的程序?
include \/\/我自己做的,你拿去用吧!\\x0d\\x0a#include \\x0d\\x0astruct e\\x0d\\x0a{\\x0d\\x0a char a[10];\\x0d\\x0a char b[10];\\x0d\\x0a}z;\\x0d\\x0aint main()\\x0d\\x0a{ int t=0;\\x0d\\x0a char s[10],d[10];\\x0d\\x0a FILE *p;\\x0d...

C语言,编写一个程序 用户输入运算符和四则运算符,输出计算结果_百度...
{ int a=1,b,c;char op;while(a||b){ printf("请输入一个算式(二数都为0时结束):");scanf("%d%c%d",&a,&op,&b);if(a==0&&b==0)break;if(op=='+')c=a+b;if(op=='-')c=a-b;if(op=='*')c=a*b;if(op=='\/')c=a\/b;if(op=='%')c=a%b;printf("%d%c...

用c语言编写一程序,用户输入日期,计算该日是今年的第几天
intday,month,year,sum,leap;printf("\\npleaseinputyear,month,day\\n");scanf("%d,%d,%d",&year,&month,&day);switch(month)\/*先计算某月以前月份的总天数*\/ { case1:sum=0;break;case2:sum=31;break;case3:sum=59;break;case4:sum=90;break;case5:sum=120;break;case6:sum=151;...

用c语言编程:编写一个程序,输入4个数,求其平均值
在C语言编程中,要创建一个实用的程序,其核心功能是接收用户输入的四个数值,然后计算并输出它们的平均值。以下是实现这个功能的详细步骤和代码片段:首先,确保你的程序中包含main()函数,这是C语言程序的基本结构。在main()函数内部,你需要声明和初始化四个变量来存储用户的输入,然后通过scanf()函数...

C语言中怎么编写一个让用户注册登陆并将其注册的信息密码保存的程序模块...
我有一个C++的运行程序需要输入密码的程序,输入正确可以修改密码,密码保存在文件中是加密的。至于注册之类的可以再加上一个文件保存用户名和密码,再在程序里加上功能选择的代码,注册时扫描一遍文件中的名字,如果存在就提示,否则就OK。。。include<iostream> include<fstream>\/\/ 文件输入输出流 define...

南乐县19827331247: 用C语言程序编写用户名密码 程序 -
主父霞精制: #include<stdio.h> #include<string.h> void main() {int i,flag1,flag2;char name[20]="lushan",password[10]="123456";char person[20],password1[10];for(i=0;i!=3;){printf("Please input the name:\n");gets(person);flag1=strcmp(person,...

南乐县19827331247: C语言用c写一个可以验证账号,密码和修改密码的程序
主父霞精制: #include <string.h> struct e { char a[10]; char b[10]; }z; int main() { int t=0; char s[10],d[10]; FILE *p; void as(); if ((p=fopen("m.txt","r+"))==NULL) { p=fopen("m.txt","w+"); t=1; } if(t==1) { printf("当前没有任何用户\n"); printf("请新建用户...

南乐县19827331247: 怎么用c语言写一个创建用户名和密码并且能修改密码的程序? -
主父霞精制: 用文件操作就好了,把账号密码保存在文件里. 登陆时对照文件里的数据,符合才允许登陆; 修改密码就该文件里账号对应的密码就好.

南乐县19827331247: C语言编程实现用户的注册和登录 求代码啊 -
主父霞精制: #include "stdafx.h" #include "string.h" #define n 20void zhuce(); void denglu(); char yhm[n],mm[n]; int main(int argc, char* argv[]) {int i;printf("-----------\n1.注册\n2.登陆\n3.继续\n0.退出\n");scanf("%d",&i); switch(i) {case 0: break; case ...

南乐县19827331247: C语言程序设计 密码验证程序设计 -
主父霞精制: #include #include #include #include #include #include #include #include #include #include #include #include #include int mima(int az); int main() {system("md pass");system("cls");cout< cout< cout< cout< cout< cout< cout< cout< cout< cout...

南乐县19827331247: 如何用C语言编写密码程序 -
主父霞精制: 1、用一个字符数组来存密码 再用一个字符数组接收你的输入,然后用strcmp 来比较,如果返回0则密码是正确的 2、例程: 1 2 3 4 5 6 7 8 9 10 11 12 13 14#include "stdio.h" #include "string.h" intmain() {charmima[100]="YuanShi888";charinput[100]={0};printf("请输入密码:");gets(input);if(strcmp(mima,input)==0)printf("恭喜你,密码正确!\n");elseprintf("对不起,密码输入错误!\n");}

南乐县19827331247: 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'...

南乐县19827331247: C语言编写密码填写程序
主父霞精制: 需要写一个循环查当前应用程序的进程名称,如果找到有符合的,就获取主窗口句柄,然后向这个主窗口发送键盘消息

南乐县19827331247: 谁可以帮我用c语言搞一个登陆密码程序
主父霞精制: #define USER "admin"#define PASSWORD "12345678"void password() { char name[21];char pw[11];int i;for(i=0;i<3;i++){printf("\nEnter User name: ");gets(name);printf("\nEnter password :");gets(pw);if((strcmp(name,USER)==0)&&(strcmp(pw,PASSWORD)==0))break;}if(i>2){printf("您已连续3次将用户名或密码输错,系统将退出!");

南乐县19827331247: 用 C 语言写一个程序:功能:验证账号、密码,修改密码;默认账号: Admi -
主父霞精制: 代码:#include <stdio.h>#include <string.h>#define M 50#define N 128// 系统保存的账号和密码 char name[M]; char pass[N]; char cryname[M]; char crypass[N];// 简单加密函数 char * crypt(char s[]){ int i; char cry[128]={'\0'}; for(i=0;s[i];i++){ cry[i]=s[i]...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网