當前位置:首頁 » 編程語言 » 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;
}

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:580
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:875
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:569
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:754
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:672
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:999
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:242
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:102
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:793
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:699