Commit b350b665 by erfeld

Update .c

parent da9a894f
Showing with 7 additions and 22 deletions
#include <stdio.h>
#include <string.h>
int kontroll(char b[16]){
int kontroll(char a[16]){
int i;
for (i = 0; i < strlen(b); i++){
if (b[i] != '0' && b[i] != '1'){
for (i = 0; i < strlen(a); i++){
if (a[i] != '0' && a[i] != '1'){
printf("Lubamatu sisend\n");
return 1;
}
}
if (strlen(b) != 4){
if (strlen(a) != 4){
printf("Lubamatu sisend\n");
return 1;
}
return 0;
}
int sisestus(const char tekst[40], char a[16], char b[16], char c[16], char d[16]){
int i;
printf("%s", tekst);
......@@ -28,43 +27,29 @@ int sisestus(const char tekst[40], char a[16], char b[16], char c[16], char d[16
}
}
if (strlen(a) == 4){
/*printf("\n%s\n", a);
printf("Sisestage K-kaardi TEINE rida \n");
scanf("%s", b);*/
do{
printf("\n%s\n", a);
printf("Sisestage K-kaardi TEINE rida \n");
scanf("%s", b);
}while(kontroll(b) == 1);
printf("\n%s\n", a);
printf("%s\n", b);
printf("Sisestage K-kaardi KOLMAS rida \n");
scanf("%s", c);
do{
printf("Lubamatu sisend: %s", c);
printf("\n%s\n", a);
printf("%s\n", b);
printf("Sisestage K-kaardi KOLMAS rida \n");
scanf("%s", c);
}while(kontroll(c) == 1);
printf("\n%s\n", a);
printf("%s\n", b);
printf("%s\n", c);
printf("Sisestage K-kaardi NELJAS rida \n");
scanf("%s", d);
do{
printf("Lubamatu sisend: %s", d);
printf("\n%s\n", a);
printf("%s\n", b);
printf("%s\n", c);
printf("Sisestage K-kaardi NELJAS rida \n");
scanf("%s", d);
}while(kontroll(d) == 1);
printf("\nTerviklik kaart:\n");
printf("\n%s\n", a);
printf("%s\n", b);
......@@ -239,7 +224,6 @@ int main(void){
char a[16], b[16], c[16], d[16];
int input;
input = sisestus("Sisestage 4x4 Karnaugh kaart voi 16 loogikavaartust: \n", a, b, c, d);
kontroll(a);
if (input == 1){
return 1;
}
......@@ -248,3 +232,4 @@ int main(void){
return 0;
}
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