Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
krkris
/
Loogikafunktsioon
This project
Loading...
Sign in
Toggle navigation
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
b350b665
authored
Mar 18, 2022
by
erfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update .c
parent
da9a894f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
22 deletions
.c
.c
View file @
b350b665
#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
(
"
\n
Terviklik 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
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment