C++控制台程序字符输入总结

来源:互联网 发布:淘宝同行跳失率怎么看 编辑:程序博客网 时间:2024/06/05 09:13
while (1)  {          //标准c函数,包含于stdio.h          //getchar() 字符,阻塞,要按回车,回显          //gets()    字串,阻塞,要按回车,回显            //微软c函数,包含于conio.h          //getch()    字符,阻塞,不用按回车,不回显          //getche()   字符,阻塞,不用按回车,回显            //微软c++ STL <string> <iostream>          //getline()  字串,同gets,但可设定结束字符          //cin>>      字符或字串,同getchar、gets,丰富的类成员函数                    // 实现非阻塞输入字符判断          /*if( kbhit() )         {             if( getche() == 'q')              {                 cout << "\n程序退出……\n";                 return 0;             }         }*/  }  


原文链接:http://blog.csdn.net/shellching/article/details/8571087

原创粉丝点击