Commit c1342a4c by erfeld

Update .c

parent b350b665
Showing with 13 additions and 22 deletions
......@@ -5,12 +5,12 @@ int kontroll(char a[16]){
int i;
for (i = 0; i < strlen(a); i++){
if (a[i] != '0' && a[i] != '1'){
printf("Lubamatu sisend\n");
printf("Lubamatu sisend: %s\n", a);
return 1;
}
}
if (strlen(a) != 4){
printf("Lubamatu sisend\n");
printf("Lubamatu sisend %s\n", a);
return 1;
}
return 0;
......@@ -50,11 +50,13 @@ int sisestus(const char tekst[40], char a[16], char b[16], char c[16], char d[16
printf("Sisestage K-kaardi NELJAS rida \n");
scanf("%s", d);
}while(kontroll(d) == 1);
printf("\n");
printf("\nTerviklik kaart:\n");
printf("\n%s\n", a);
printf("%s\n", b);
printf("%s\n", c);
printf("%s\n", d);
printf("\n");
}
else if (strlen(a) >= 16){
......@@ -64,28 +66,20 @@ int sisestus(const char tekst[40], char a[16], char b[16], char c[16], char d[16
return 1;
}
}
printf("\n");
printf("Toevaartused: %s", a);
printf("\n");
}
else{ // Kui kasutaja sisestab mittesobiva märkide arvu, siis programm teeb exit.
printf("Lubamatu sisend: %s", a);
printf("Lubamatu sisend: %s\n", a);
return 1;
}
return 0;
}
/*char array[4][4] = {{
a[20],
b[20],
c[20],
d[20]
}};
int j;
for (i = 0; i < 4; i++){
for (j = 0; j < 4; j++){
printf("%c", array[i][j]);
}
}*/
void info(char a[16], char b[16], char c[16], char d[16]){
char f0;
char f1;
......@@ -222,11 +216,8 @@ void info(char a[16], char b[16], char c[16], char d[16]){
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);
if (input == 1){
return 1;
}
sisestus("Sisestage 4x4 Karnaugh kaart voi 16 loogikavaartust: \n", a, b, c, d);
info(a, b, c, d);
......
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