how to set c++ if...else statement for user input?

65 views Asked by At

i would like the TEdit label to print "Success!" for correct username input and "Error" for incorrect username input. i have tried this code:

void __fastcall TForm1::UsernameEditChange(TObject *Sender)
{
    string username = "admin";
    string result = (username == "admin") ? "Success!" : "Error";
    std::cout << result;
}

i get an error saying the type "string" is unknown. how do i fix this so that the if...else statement functions for user input?

0

There are 0 answers