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
58e1803b
authored
Feb 14, 2023
by
edtell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parents
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
KT1.c
KT1.c
0 → 100644
View file @
58e1803b
#include <stdio.h>
#include <stdlib.h>
typedef
struct
{
char
nimi
[
32
];
int
kood
;
int
hinne
[
4
];
}
Inim
;
void
input
(
FILE
*
sisse
,
Inim
*
);
void
print
(
Inim
*
,
Inim
*
);
void
fnimi
(
char
*
,
char
*
);
int
loe
(
FILE
*
sisse
);
int
main
(
void
){
int
N
=
0
;
FILE
*
sisse
;
FILE
*
valja
;
char
nimi
[
128
];
fnimi
(
nimi
,
"sisestame input faili nimi: "
);
sisse
=
fopen
(
nimi
,
"r"
);
N
=
loe
(
sisse
);
if
(
sisse
==
NULL
){
printf
(
"Pole faili
\n
"
);
return
1
;
}
int
k
=
0
;
Inim
nimekiri
[
N
];
while
(
!
feof
(
sisse
))
{
input
(
sisse
,
&
nimekiri
[
k
]);
k
++
;
}
fclose
(
sisse
);
fnimi
(
nimi
,
"sisestame output faili nimi: "
);
printf
(
"
\n
"
);
valja
=
fopen
(
nimi
,
"r+"
);
fclose
(
valja
);
return
0
;
}
void
fnimi
(
char
*
nimi
,
char
*
tekst
){
printf
(
"%s"
,
tekst
);
scanf
(
"%s"
,
nimi
);
}
int
loe
(
FILE
*
sisse
){
int
i
=
0
;
char
buff
[
59
];
int
buff2
,
buff3
[
4
];
while
(
fscanf
(
sisse
,
"%s %d %d,%d,%d,%d"
,
buff
,
&
buff2
,
&
buff3
[
0
],
&
buff3
[
1
],
&
buff3
[
2
],
&
buff3
[
3
])
!=
EOF
){
i
++
;
}
rewind
(
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