您的位置:首页 > 编程语言 > C语言/C++

今天收获的知识。。。。。。

2007-03-20 13:02 295 查看
1。在dos窗口中显星号

#include "stdio.h"

int main(int argc, char* argv[])
{

char password[20],c;
int i = 0;
while(1)
{
c = getch();
if(c == 13)
break;
password[i++] = c;
printf("*");
}
password[i] = '/0';
printf("/nThe input password is %s/n",password); getch();
return 0;
}

2。c++中的getch()在"conio.h"头文件中

3。若要让程序暂停若干秒,需要用Sleep()。调用该函数需要#include"windows.h"

如Sleep(1000); //暂停1秒

4。dos窗口清屏用system("cls");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  dos system input c++ c