Commit 0da263e3 by erfeld

Update Kasutaja sisestuse kontrollimise meetodid

parent 6e846d53
Showing with 16 additions and 0 deletions
...@@ -15,3 +15,18 @@ int sisestus(const char tekst[40], char a[20], char b[20], char c[20], char d[20 ...@@ -15,3 +15,18 @@ int sisestus(const char tekst[40], char a[20], char b[20], char c[20], char d[20
} }
} }
1. võimalus: if (strcmp("0000", a) == 1 && strcmp("0001", a) == 1 && strcmp("0010", a) == 1 && strcmp("0011", a) == 1 && strcmp("0100", a) == 1 && strcmp("0111", a) == 1 && strcmp("0010", a) == 1 && strcmp("0010", a) == 1 && strcmp("0010", a) == 1 && strcmp("0010", a) == 1 && strcmp("0010", a) == 1 && strcmp("0010", a) == 1 && strcmp("0010", a) == 1 && strcmp("0010", a) == 1 && strcmp("0010", a) == 1 && strcmp("0010", a) == 1){
printf("Lubamatu sisend: %s", a);
return 1;
2.võimalus: char one[] = "1";
char zero[] = "0";
for (i = 0; i < strlen(a); i++){
if (strcmp(a[i], one) != 0 && strcmp(a[i], zero) != 0){
printf("Lubamatu sisend: %s", a);
}
}
2. võimalus pole veel täielik.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment