Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

krkris / Loogikafunktsioon

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit e94f9aff authored 3 years ago by krkris's avatar krkris
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

Update Kood.c

parent 72880b84 master
Show whitespace changes
Inline Side-by-side
Showing with 168 additions and 0 deletions
  • Kood.c
Kood.c
View file @ e94f9aff
#include <stdio.h>
#include <string.h>
typedef struct{
char kood[5];
int indeks;
}implikandid;
typedef struct{
char kood[5];
int indeks;
}implikandid2;
int kontroll(char a[16]){
int i;
for (i = 0; i < strlen(a); i++){
......@@ -217,6 +227,164 @@ void info(char a[16], char b[16], char c[16], char d[16]){
else{
printf("ilma [x4] PAARIS\n");
}
implikandid implikant[16];
int i = 0;
int arv = 0;
int j, k;
/*char array[16] = {f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, fA, fB, fC, fD, fE, fF};
for(i = 0; i<16; i++){
if(array[i] == '1'){
arv++;
}
}*/
if(f0 == '1'){
strcpy(implikant[i].kood, "0000");
implikant[i].indeks = 0;
i++;
}
if(f1 == '1'){
strcpy(implikant[i].kood, "0001");
implikant[i].indeks = 1;
i++;
}
if(f2 == '1'){
strcpy(implikant[i].kood, "0010");
implikant[i].indeks = 1;
i++;
}
if(f3 == '1'){
strcpy(implikant[i].kood, "0011");
implikant[i].indeks = 2;
i++;
}
if(f4 == '1'){
strcpy(implikant[i].kood, "0100");
implikant[i].indeks = 1;
i++;
}
if(f5 == '1'){
strcpy(implikant[i].kood, "0101");
implikant[i].indeks = 2;
i++;
}
if(f6 == '1'){
strcpy(implikant[i].kood, "0110");
implikant[i].indeks = 2;
i++;
}
if(f7 == '1'){
strcpy(implikant[i].kood, "0111");
implikant[i].indeks = 3;
i++;
}
if(f8 == '1'){
strcpy(implikant[i].kood, "1000");
implikant[i].indeks = 1;
i++;
}
if(f9 == '1'){
strcpy(implikant[i].kood, "1001");
implikant[i].indeks = 2;
i++;
}
if(fA == '1'){
strcpy(implikant[i].kood, "1010");
implikant[i].indeks = 2;
i++;
}
if(fB == '1'){
strcpy(implikant[i].kood, "1011");
implikant[i].indeks = 3;
i++;
}
if(fC == '1'){
strcpy(implikant[i].kood, "1100");
implikant[i].indeks = 2;
i++;
}
if(fD == '1'){
strcpy(implikant[i].kood, "1101");
implikant[i].indeks = 3;
i++;
}
if(fE == '1'){
strcpy(implikant[i].kood, "1110");
implikant[i].indeks = 3;
i++;
}
if(fF == '1'){
strcpy(implikant[i].kood, "1111");
implikant[i].indeks = 4;
i++;
}
printf("\n");
printf("%s\n", implikant[0].kood);
for(j = 0; j<i; j++){
printf("%d\n", implikant[j].indeks);
}
int eri = 0;
implikandid2 implikant2[16];
int q;
char arr[5];
int t = 0;
for(j = 0; j<i; j++){
for(k = 0; k<i; k++){
if(implikant[i].indeks - implikant[k].indeks == 1 || implikant[i].indeks - implikant[k].indeks == -1){
if(implikant[i].kood[0] != implikant[k].kood[0]){
eri++;
q = 0;
}
if(implikant[i].kood[1] != implikant[k].kood[1]){
eri++;
q = 1;
}
if(implikant[i].kood[2] != implikant[k].kood[2]){
eri++;
q = 2;
}
if(implikant[i].kood[3] != implikant[k].kood[3]){
eri++;
q = 3;
}
if(eri == 1){
strcpy(implikant2[0].kood, implikant[i].kood);
printf("%s", implikant2[0].kood);
/*printf("\n");
arr[0] = '-';
arr[1] = implikant[i].kood[1];
arr[2] = implikant[i].kood[2];
arr[3] = implikant[i].kood[3];
printf("%s", arr);*/
/*if(q == 0){
implikant2[t].kood[0] = '-';
}
t++;*/
}
}
}
}
}
......
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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