Ejemplo: cómo hacer un inicio de sesión en C ++
// a simple login for c++ using while loops and io (input output)
#include <iostream>
#include <string>
using namespace std;
int main() {
cout << "please enter password";
string pass = "0"; // making a string for user input
cin >> pass; // could be replaced with getline(cin, pass);
while (pass = "1234") { // while loop for when password is wrong
cout << "incorrect, try again";
cin >> pass; // could be replaced with getline(cin, pass);
}
cout << "correct password"; // runs when the while loop is no longer happening
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)