Ich verstehe nicht ganz warum das Programm nicht ausgibt, dass der Zutritt für das Alter verweigert ist... Hier sind die Eingaben:
Hier ist der Code:
Code:
Enter your age here: 17
You need a Person to look after you, what is his name and how old is he?: Ralf Ratte,14
You can enter the Club now! Have fun!
Program ended with exit code: 0
Hier ist der Code:
C:
#include <stdio.h>
int main() {
int agePerson1, agePerson2;
char prename[20], surname[20];
printf("Enter your age here: ");
scanf("%d", &agePerson1);
if(agePerson1 < 18 && agePerson1 >= 16){
printf("\n You need a Person to look after you, what is his name and how old is he?: ");
scanf("%s %s,%d", prename, surname, &agePerson2);
if(agePerson2 < 18){
printf("\n This Person is not permitted to look after you! \n");
}else {
printf("\n You can enter the Club now! Have fun! \n");
}
}else if(agePerson1 >= 18){
printf("\n You can enter the Club now! Have fun! \n");
printf("We are here");
}else{
printf("\n You are to young to even visit a club! \n");
}
return 0;
}