|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 drt 于 2017-4-30 11:24 编辑
#include <iostream>
#include <windows.h>
#include <stdlib.h>
#include <string>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <conio.h>
using namespace std;
string number1;
string number2;
string name;
void Gotoxy(int x, int y) //光标函数
{
int xx=0x0b;
HANDLE hOutput;
COORD loc;
loc.X = x;
loc.Y = y;
hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOutput, loc);
return;
}
int in()
{
number2.clear();
system("cls");
cout<<" =========================="<<endl;
cout<<" # 请输入账号 #"<<endl;
cout<<" =========================="<<endl;
cout<<" # #"<<endl;
cout<<" =========================="<<endl;
cout<<" # 请输入密码 #"<<endl;
cout<<" =========================="<<endl;
cout<<" # #"<<endl;
cout<<" =========================="<<endl;
Gotoxy(30,3);
getline(cin,number1);
//cin.ignore(100,'\n');
Gotoxy(30,7);
char ch;
int count = 0;
while(ch = getch())
{
if(ch == '\r')
{
break;
}
if(ch == 8)
{
if(count != 0)
{
cout<<char(8)<<" "<<char(8);
number2.erase(number2.size()-1,1);
count--;
}
}
else
{
if(count < 20)
{
count++;
cout<<"*";
}
number2.push_back(ch);
}
}
if(GetAsyncKeyState(VK_DELETE))
{
return 0;
}
}
int main()
{
in();
cout<<"nsjwhfchewhie";
}
请问为什么这个异步按delete键不能结束函数啊
求助 谢谢 |
|