Commit a6354828 by erfeld

Delete Kasutaja sisestuse kontrollimise meetodid

parent b35c0d2d
Showing with 0 additions and 33 deletions
int sisestus(const char tekst[40], char a[20], char b[20], char c[20], char d[20]){
int i;
printf("%s", tekst);
scanf("%s", a);
if (strlen(a) == 4){
/*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;
}*/
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);
}
}
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