12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
编程知识 时间:2024-12-03 17:07:05
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
在C语言中,可以使用密码输入的方式来隐藏输入的数字。下面是一个示例代码:#include <stdio.h>#include <conio.h>int main() {char password[20];int num;printf("Enter a num
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
在C语言中,可以使用密码输入的方式来隐藏输入的数字。下面是一个示例代码:
#include <stdio.h>#include <conio.h>int main() {char password[20];int num;printf("Enter a number: ");scanf("%d", &num);printf("Enter password to hide the number: ");int i = 0;while (1) {password[i] = getch();if (password[i] == 13) {break;} else {printf("*");}i++;}password[i] = '\0'; // null-terminate the passwordprintf("\nHidden number: %d\n", num);return 0;}
在这个示例代码中,用户首先输入一个数字,然后输入一个密码来隐藏这个数字。当用户输入密码时,数字将被隐藏,只有*字符显示出来。
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19