08.12.2016, 21:19
Hallo,
ich habe folgenden Code im Internet gefunden:
ich habe folgenden Code im Internet gefunden:
PHP-Code:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <windows.h>
char initChoice;
char username;
char password;
char usery0;
char passy0;
void Login();
void Register();
int main()
{
system("title XeClutch - Simple Login System");
system("color a");
printf("Hello, what would you like to do?\n[A] Login\n[B] Register\n");
scanf("%c", &initChoice);
if(initChoice == 'A' || initChoice == 'a')
{
Login();
}
else if(initChoice == 'B' || initChoice == 'b')
{
Register();
}
else
{
printf("Invalid Operation...");
system("pause");
}
return 0;
}
void Login()
{
printf("\n\nPlease enter your username: ");
scanf("%s", &usery0);
if(usery0 == username)
{
printf("Please enter your password: ");
scanf("%s", &password);
if(passy0 == password)
{
printf("Successful Login!");
system("pause");
}
else
{
printf("Incorrect Password...\n");
system("pause");
}
}
else
{
printf("Incorrect Username...\n");
system("pause");
}
}
void Register()
{
printf("\n\nEnter a new username: ");
scanf("%s", &username);
printf("Enter a new password: ");
scanf("%s", &password);
printf("\nRegistration Successful!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
main();
}
Nun wollte ich fragen, wie ich am besten die Eingabe vom Dialog-Textfeld verwende.
Ich habe das Script soweit gekürzt:
PHP-Code:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <windows.h>
char username;
char password;
char usery0;
char passy0;
void Login();
void Login()
{
scanf("%s", &usery0);
if(usery0 == username)
{
printf("Please enter your password: ");
scanf("%s", &password);
if(passy0 == password)
{
printf("Successful Login!");
system("pause");
}
else
{
printf("Incorrect Password...\n");
system("pause");
}
}
else
{
printf("Incorrect Username...\n");
system("pause");
}
}
Da ich absoluter C++ Anfänger bin, hab ich noch nicht so wirklich den Durchblick. Wäre sehr erfreut, wenn mir jemand helfen könnte^^