ich muss ein Passwortprogramm schreiben.
So weit bin ich:
- Code: Alles auswählen
#include <stdio.h>
int checkPassword (char acEnteredPassw[], char acRealPassw[]);
int main ()
{
const int iLENGTH = 3;
char acEnteredPassw[iLENGTH];
char acRealPassw[]= {'1', '2', '3'};
int iDone = 1;
printf ("Enter the password: ");
gets (acEnteredPassw);
printf ("Your entry: %s\n", acEnteredPassw);
checkPassword (acEnteredPassw, acRealPassw);
if (iDone)
{
printf ("Your entry is right!");
}
else
{
printf ("You have entered a wrong password");
}
system ("pause");
return 0;
}
int checkPassword (char acEnteredPassw[], char acRealPassw[])
{
int iDone = 1;
if (acEnteredPassw = acRealPassw)
{
return iDone;
}
else
{
return 0;
}
}
Die Überprüfung: if (acEnteredPassw = acRealPassw) funktioniert nicht.
Warum nicht?, könnt ihr mir helfen?
Es handelt sich um die Sprache C.