Commit 08aed4eb by erfeld

Update Kood.c

- Tõeväärtuste vahele lisatud tühikud lõpliku K-kaardi kuvamisel
- Eemaldatud string-lausetest punktid, muud vormistused stringides
- K-kaardi kuvamine ka 16 järjestiku loogikaväärtuse sisestamisel
parent 80d44d6c
Showing with 33 additions and 20 deletions
...@@ -29,28 +29,39 @@ int sisestus(const char tekst[40], char a[16], char b[16], char c[16], char d[16 ...@@ -29,28 +29,39 @@ int sisestus(const char tekst[40], char a[16], char b[16], char c[16], char d[16
if (strlen(a) == 4){ if (strlen(a) == 4){
do{ do{
printf("\n%s\n", a); printf("\n%s\n", a);
printf("Sisestage K-kaardi TEINE rida \n"); printf("Sisestage K-kaardi TEINE rida: \n");
scanf("%s", b); scanf("%s", b);
}while(kontroll(b) == 1); }while(kontroll(b) == 1);
do{ do{
printf("\n%s\n", a); printf("\n%s\n", a);
printf("%s\n", b); printf("%s\n", b);
printf("Sisestage K-kaardi KOLMAS rida \n"); printf("Sisestage K-kaardi KOLMAS rida: \n");
scanf("%s", c); scanf("%s", c);
}while(kontroll(c) == 1); }while(kontroll(c) == 1);
do{ do{
printf("\n%s\n", a); printf("\n%s\n", a);
printf("%s\n", b); printf("%s\n", b);
printf("%s\n", c); printf("%s\n", c);
printf("Sisestage K-kaardi NELJAS rida \n"); printf("Sisestage K-kaardi NELJAS rida: \n");
scanf("%s", d); scanf("%s", d);
}while(kontroll(d) == 1); }while(kontroll(d) == 1);
printf("\n"); printf("\n");
printf("\nTerviklik kaart:\n"); printf("\nTerviklik kaart:\n");
printf("\n%s\n", a); for (i = 0; i < strlen(a); i++){
printf("%s\n", b); printf("%c ", a[i]);
printf("%s\n", c); }
printf("%s\n", d); printf("\n");
for (i = 0; i < strlen(b); i++){
printf("%c ", b[i]);
}
printf("\n");
for (i = 0; i < strlen(c); i++){
printf("%c ", c[i]);
}
printf("\n");
for (i = 0; i < strlen(d); i++){
printf("%c ", d[i]);
}
printf("\n"); printf("\n");
} }
...@@ -62,8 +73,11 @@ int sisestus(const char tekst[40], char a[16], char b[16], char c[16], char d[16 ...@@ -62,8 +73,11 @@ int sisestus(const char tekst[40], char a[16], char b[16], char c[16], char d[16
} }
} }
printf("\n"); printf("\n");
printf("Toevaartused: %s", a); printf("\nK-kaardi kujul:\n");
printf("\n"); printf("%c %c %c %c\n", a[0], a[1], a[3], a[2]);
printf("%c %c %c %c\n", a[4], a[5], a[7], a[6]);
printf("%c %c %c %c\n", a[8], a[9], a[11], a[10]);
printf("%c %c %c %c\n", a[12], a[13], a[15], a[14]);
} }
else{ // Kui kasutaja sisestab mittesobiva märkide arvu, siis programm teeb exit. else{ // Kui kasutaja sisestab mittesobiva märkide arvu, siis programm teeb exit.
...@@ -135,10 +149,10 @@ void info(char a[16], char b[16], char c[16], char d[16]){ ...@@ -135,10 +149,10 @@ void info(char a[16], char b[16], char c[16], char d[16]){
} }
if (f0 == '1'){ if (f0 == '1'){
printf("Konstant 1 olemas.\n"); printf("Konstant 1 olemas\n");
} }
else{ else{
printf("Konstant 1 puudub.\n"); printf("Konstant 1 puudub\n");
} }
if (fF == '1'){ if (fF == '1'){
...@@ -149,56 +163,56 @@ void info(char a[16], char b[16], char c[16], char d[16]){ ...@@ -149,56 +163,56 @@ void info(char a[16], char b[16], char c[16], char d[16]){
} }
if (f0 == f8){ if (f0 == f8){
printf("x1 puudub.\n"); printf("x1 puudub\n");
} }
else{ else{
printf("x1 olemas\n"); printf("x1 olemas\n");
} }
if (f0 == f4){ if (f0 == f4){
printf("x2 puudub.\n"); printf("x2 puudub\n");
} }
else{ else{
printf("x2 olemas\n"); printf("x2 olemas\n");
} }
if (f0 == f2){ if (f0 == f2){
printf("x3 puudub.\n"); printf("x3 puudub\n");
} }
else{ else{
printf("x3 olemas\n"); printf("x3 olemas\n");
} }
if (f0 == f1){ if (f0 == f1){
printf("x4 puudub.\n"); printf("x4 puudub\n");
} }
else{ else{
printf("x4 olemas\n"); printf("x4 olemas\n");
} }
if (f7 == '1'){ if (f7 == '1'){
printf("ilma [x1] PAARITU.\n"); printf("ilma [x1] PAARITU\n");
} }
else{ else{
printf("ilma [x1] PAARIS\n"); printf("ilma [x1] PAARIS\n");
} }
if (fB == '1'){ if (fB == '1'){
printf("ilma [x2] PAARITU.\n"); printf("ilma [x2] PAARITU\n");
} }
else{ else{
printf("ilma [x2] PAARIS\n"); printf("ilma [x2] PAARIS\n");
} }
if (fD == '1'){ if (fD == '1'){
printf("ilma [x3] PAARITU.\n"); printf("ilma [x3] PAARITU\n");
} }
else{ else{
printf("ilma [x3] PAARIS\n"); printf("ilma [x3] PAARIS\n");
} }
if (fE == '1'){ if (fE == '1'){
printf("ilma [x4] PAARITU.\n"); printf("ilma [x4] PAARITU\n");
} }
else{ else{
printf("ilma [x4] PAARIS\n"); printf("ilma [x4] PAARIS\n");
...@@ -220,4 +234,3 @@ int main(void){ ...@@ -220,4 +234,3 @@ int main(void){
return 0; 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