#include <stdio.h>
#include <conio.h>
int main(int argc, char *argv[])
{
char wrd = '\0';
char *word = "abcdefghijklmnopqrstuvwxyz ";
char *pwd = "123456789abcdefghi@#$%&!*";
while ((wrd = getch()) != '\\')//此函数输入无回显,\做为循环结束符
{
if (wrd == ' ')
{
printf("%c", 'j');
}
else
{
for (char *i = pwd; *i != '\0'; i++)
{
if (wrd == word)
{
printf("%c", *i);
}
if (wrd == '\r')//\r代表回车键
{
printf("\n");//打印换行符
break;
}
}
}
}
return 0;
}
--------------------------------------------------------------------------------------------------------------------------------
Microsoft Windows [版本 10.0.18363.418]
(c) 2019 Microsoft Corporation。保留所有权利。
E:\Users\admin\Documents\VScode>c:\Users\admin\.vscode\extensions\ms-vscode.cpptools-0.26.1\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-yg043dqo.c1d --stdout=Microsoft-MIEngine-Out-y4g2bdi5.ytp --stderr=Microsoft-MIEngine-Error-5ilx0qta.nx3 --pid=Microsoft-MIEngine-Pid-2zqzkmnr.ce2 --dbgExe=D:\MinGW\bin\gdb.exe --interpreter=mi
h&478aa6@477
1678647@6@11@
7@6@11@41@6717@j
jjj@6@@1416
j6@16617
E:\Users\admin\Documents\VScode> 请问这个wrd == word 是怎么判断的萌新指针才刚学,看不懂
页:
[1]