下面的程式碼是我打的...(不是最後的完成圖的程式碼)
語法:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
main()
{
char pass[100]="OPEN THE DOOR !",g[100];
start:
printf("輸入密碼 :");
fflush(stdin);
g[0]=getch();g[1]=getch();g[2]=getch();g[3]=getch();
g[4]=getch();g[5]=getch();g[6]=getch();g[7]=getch();
g[8]=getch();g[9]=getch();g[10]=getch();g[11]=getch();
g[12]=getch();g[13]=getch();g[14]=getch();g[15]=getch();
g[16]=getch();g[17]=getch();g[18]=getch();g[19]=getch();
g[20]='\0';
printf("\n\n");
printf("你輸入的是 : %s",g);
printf("\n\n");
system("pause");
goto start;
}
請問喔...
第6行的框中數字怎麼改?功能是?char pass[
100]="happy new year !",g[
100];
g[]=getch(); 怎麼用迴圈化簡?
要如何改成輸入的字變成"*"號?(我的程式碼不會顯示任何東西)
輸入後,可以直接按enter,不用打完(20個字)讓程式自動跳?
要如何檢查輸入的字是否為"happy new year !" ?
