當前位置:首頁 » 編程語言 » c語言修改密碼

c語言修改密碼

發布時間: 2025-02-24 19:57:13

⑴ 用c語言或者其他語言編寫替代密碼和置換密碼

給你,自己再稍微改造一下吧:
#include "stdio.h"
#include "conio.h"

main()
{
int k,i=0;
char a[100],b[100];
printf("qing shu ru ni de mi wen \n");
gets(a);
printf("qing shu ru mi shi \n");
scanf("%d",&k);
printf("\n");
do{
b[i]=(char)(a[i]+k);
if(b[i]>122){
b[i]=(char)(b[i]-26);
}
i++;
}while(a[i]!='\0');
puts(b);
getch();
}

⑵ c語言 替換 簡易密碼代換

#include <stdio.h>

void main()
{
int i=0, j=0;
char a[100] = {0};
scanf("%s",a);
while ('\0' != a[i])
{
a[i] += 4;
if (a[i] > 'z')
{
a[i] -= 26;
}
else if (a[i] > 'Z' && a[i] < 'e')
{
a[i] -= 26;
}
++i;
}
printf("%s",a);
}
驗證無問題

⑶ c語言 修改密碼初始密碼為123456,密碼包含數字和字母,數字必須大於2位

#include<stdio.h>
#include<string.h>
#include<ctype.h>
intmain()
{charpsw[21]="123456",t1[21],t2[21];
inti,n=0;
printf("請輸入初始密碼: ");
do
{gets(t1);
n++;
err=strcmp(t1,psw);
if(err)printf("初始密碼錯誤!請重新輸入! ");
}
while(err&&n<3);
if(strcmp(t1,psw))
{printf("密碼錯誤,不能登錄! ");
return0;
}
while(n<3)
{while(n<3)
{printf("請輸入新密碼: ");
gets(t1);
for(i=0;t1[i];i++)
if(isdigit(t1[i]))n++;
if(n<3)
{n=0;
printf("數字必須大於2位! ");
}
}
printf("請再次輸入新密碼: ");
gets(t2);
if(strcmp(t1,t2)==0)
printf("密碼修改成功! ");
else
{printf("二次密碼不一致! ");
n=0;
}
}
return0;
}

熱點內容
段式編譯器 發布:2025-04-22 20:15:45 瀏覽:202
android原版 發布:2025-04-22 20:15:04 瀏覽:74
特種兵一個組怎麼配置 發布:2025-04-22 20:01:15 瀏覽:733
oracle資料庫命令 發布:2025-04-22 19:47:55 瀏覽:564
python異或運算符 發布:2025-04-22 19:45:21 瀏覽:832
網路為什麼改不了伺服器 發布:2025-04-22 19:44:38 瀏覽:535
js壓縮base64 發布:2025-04-22 19:29:53 瀏覽:200
颶風加密工具 發布:2025-04-22 19:27:50 瀏覽:640
發票江蘇伺服器地址 發布:2025-04-22 19:21:29 瀏覽:34
編譯器路徑錯誤 發布:2025-04-22 18:53:30 瀏覽:39