|

09.01.2008, 16:46
|
| |
Den code habe ich von einem kollegen bekommen aber er funktioniert noch nicht aber vielleicht hilft es euch ja trotzdem. Code: #include <iostream>
#include <string>
using namespace std;
#include <conio.h>
string get_pw();
int main()
{
cout << "cbx" << endl;
string pw = get_pw();
cout << endl << endl << "your pw: " << pw << endl;
return 0;
}
string get_pw()
{
system("PAUSE");
cout << endl << "Enter your password: ";
int x = 1;
string result
char c;
bool firstCharDeleted = false;
do
{
c = getch();
if( c == 8 )
{
if( x <= 1 )
continue;
if( firstCharDeleted )
x--;
firstCharDeleted = true;
gotoxy( x, 3 );
cout << ' ';
result = result.substr( 0, result.length() - 1 );
continue;
}
else if( c == 13 )
break;
firstCharDeleted = false;
x++;
gotoxy( x, 3 );
cout << '*';
result += c;
}while( true );
return result;
} |