當前位置:首頁 » 編程語言 » C語言口令

C語言口令

發布時間: 2023-07-28 13:44:40

A. c語言for循環判定回車的問題

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

int main()
{
char *key[10]={"Apple","Icecream","Pear","Banana","Keyword"},c[10];
int i,a;

printf("請輸入學生座位號:");
scanf("%d",&a);
//吃掉輸入座位號後的回車
getchar();
printf("請輸入用戶口令:");
//for循環應先進行!=的判斷,再進行i++
for(i=0;(c[i]=getchar())!='\n';i++)
{
printf("*");
}
printf("\n");
c[i]='\0';
if(strcmp(key[a-1],c)!=0)
printf("口令錯誤!");
else
printf("口令正確,歡迎使用!");
return 0;
}

B. C語言gets(password1);什麼意思

gets(password1); 這是函數調用語句,函數名 gets,參數是 password1。
gets 是 c語言標准輸入函數,功能是 從鍵盤輸入 讀入 一行字元串,存放到 password1 里。
這里 的 password1 顧名思義 是 口令,密碼。
即 從鍵盤輸入 讀入 password。
函數原型是: char * gets ( char * str );

熱點內容
蘋果手機怎麼上傳視頻到qq空間 發布:2025-08-22 07:10:03 瀏覽:636
淘寶androidsdk 發布:2025-08-22 06:52:04 瀏覽:938
編程掙錢嗎 發布:2025-08-22 06:31:21 瀏覽:1001
敬請存儲 發布:2025-08-22 06:25:42 瀏覽:610
linuxphp7配置 發布:2025-08-22 06:17:01 瀏覽:415
shellftp腳本 發布:2025-08-22 06:11:57 瀏覽:797
sql資料庫打開 發布:2025-08-22 05:58:36 瀏覽:889
伺服器IP怎麼找回 發布:2025-08-22 05:41:28 瀏覽:607
手機百度怎樣上傳視頻 發布:2025-08-22 05:28:08 瀏覽:833
亂碼源碼 發布:2025-08-22 05:26:41 瀏覽:205