Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
edtell
/
Programmeerimine_II_KT1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
44215698
authored
Feb 15, 2023
by
edtell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update KT1.c
parent
58e1803b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
7 deletions
KT1.c
KT1.c
View file @
44215698
...
...
@@ -8,7 +8,7 @@ typedef struct {
}
Inim
;
void
input
(
FILE
*
sisse
,
Inim
*
);
void
print
(
Inim
*
,
Inim
*
);
void
stip
(
FILE
*
valja
,
Inim
*
,
int
);
void
fnimi
(
char
*
,
char
*
);
int
loe
(
FILE
*
sisse
);
...
...
@@ -44,14 +44,53 @@ Inim nimekiri[N];
fnimi
(
nimi
,
"sisestame output faili nimi: "
);
printf
(
"
\n
"
);
valja
=
fopen
(
nimi
,
"r+"
);
fclose
(
valja
);
valja
=
fopen
(
nimi
,
"r+"
);
if
(
valja
==
NULL
){
printf
(
"Pole faili
\n
"
);
return
1
;
}
stip
(
valja
,
nimekiri
,
N
);
fclose
(
valja
);
return
0
;
}
void
input
(
FILE
*
sisse
,
Inim
*
keegi
)
// Viit muutujale keegi
{
fscanf
(
sisse
,
"%s %d %d,%d,%d,%d
\n
"
,
keegi
->
nimi
,
&
keegi
[
0
].
kood
,
&
keegi
[
0
].
hinne
[
0
],
&
keegi
[
0
].
hinne
[
1
],
&
keegi
[
0
].
hinne
[
2
],
&
keegi
[
0
].
hinne
[
3
]);
}
void
stip
(
FILE
*
valja
,
Inim
*
keegi
,
int
N
){
for
(
int
i
=
0
;
i
<
N
;
i
++
){
if
(
keegi
[
i
].
hinne
[
0
]
==
5
&&
keegi
[
i
].
hinne
[
1
]
==
5
&&
keegi
[
i
].
hinne
[
2
]
==
5
&&
keegi
[
i
].
hinne
[
3
]
==
5
){
fprintf
(
valja
,
"%s %d %d
\n
"
,
keegi
[
i
].
nimi
,
keegi
[
i
].
kood
,
100
);
}
else
if
(
keegi
[
i
].
hinne
[
0
]
>=
4
&&
keegi
[
i
].
hinne
[
1
]
>=
4
&&
keegi
[
i
].
hinne
[
2
]
>=
4
&&
keegi
[
i
].
hinne
[
3
]
>=
4
){
fprintf
(
valja
,
"%s %d %d
\n
"
,
keegi
[
i
].
nimi
,
keegi
[
i
].
kood
,
75
);
}
else
{
fprintf
(
valja
,
"%s %d %d
\n
"
,
keegi
[
i
].
nimi
,
keegi
[
i
].
kood
,
0
);
}
}
if
(
!
feof
(
valja
)){
printf
(
"Tehtud!
\n
"
);
printf
(
"Kontrolllige Output faili"
);
}
}
void
fnimi
(
char
*
nimi
,
char
*
tekst
){
printf
(
"%s"
,
tekst
);
...
...
@@ -71,4 +110,6 @@ int loe(FILE *sisse){
return
i
;
}
\ No newline at end of file
}
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