Eingabe mit sternchen versehen
-
Guten Tag,
Kann mir vll jemand erklären wie man eine eingabe mit sternchen versehen kann.
Programmierung ist c++ console.
-
Versehe die Frage nicht, darum rate ich:
#include <iostream> #include <string> int main() { std::cout << "*****: "; std::string eingabe; std::cin >> eingabe; std::cout << eingabe; }
-
Ich glaube, er meint ein Passwort-Feld. Das kann man einfach mit einer Schleife und
std::cin.getrealisieren.MfG, EOutOfResources
-
EOutOfResources schrieb:
Ich glaube, er meint ein Passwort-Feld. Das kann man einfach mit einer Schleife und
std::cin.getrealisieren.MfG, EOutOfResources
Wie denn das?
-
Sorry, ich meine natürlich
getch().
-
#include <iostream> #include <string> #include <conio.h> using namespace std; int main() { string str; char c; while ( (c = _getch()) != 23 ) { cout << "*"; str += c; } cout << str << endl; return 0x0; }
-
Skym0sh0 schrieb:
#include <iostream> #include <string> #include <conio.h> using namespace std; int main() { string str; char c; while ( (c = _getch()) != 23 ) { cout << "*"; str += c; } cout << str << endl; return 0x0; }Dazu gibt es '\n', damit man nicht 13 mit 23 verwechselt.