Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
antsim
/
IAG0582
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
dd951c66
authored
Feb 28, 2017
by
antsim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HW
parent
89e76459
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
0 deletions
HW/F1.txt
HW/HW1.c
HW/Programming2_HW1.docx
HW/F1.txt
0 → 100644
View file @
dd951c66
Thomas 55500077 Paldiski_45_66 Tallinn
Oleg 59428388 Kopli_3_53 Tartu
Tom 583497589 Kalev_15_25 Tallinn
Valera 57293747 Umera_55_22 Narva
Olja 55500077 Uus_66_5 Tallinn
Nika 5938499 Laagna_15_25 Tallinn
Miku 57293747 Mustam_55_22 Narva
Tanja 5923848 Tere_5_34 Tartu
Helga 5382748 Raud_3_54 Tallinn
Misha 5138472 Vara_7_43 Tallinn
\ No newline at end of file
HW/HW1.c
0 → 100644
View file @
dd951c66
#include <stdio.h>
#include <string.h>
#define string_pikkus 20
#define massiiv 10
#define array 2
typedef
struct
{
char
nimi
[
string_pikkus
];
char
tel
[
string_pikkus
];
char
aadress
[
array
][
string_pikkus
];
}
inimesed
;
int
main
(){
inimesed
isik
[
massiiv
];
int
i
=
0
;
FILE
*
fileinp
;
//declare file input
FILE
*
fileoutp
;
//declare file outp
char
inputFile
[]
=
{
"/Users/Anastassia/Desktop/F1.txt"
};
//input file name
char
outFile
[]
=
{
"/Users/Anastassia/Desktop/F2.txt"
};
//output file name
fileinp
=
fopen
(
inputFile
,
"r"
);
//fopen()
fileoutp
=
fopen
(
outFile
,
"w"
);
//
//control if file available
if
(
fileinp
==
NULL
)
{
printf
(
"File not found.
\n
"
);
}
while
(
!
feof
(
fileinp
)){
fscanf
(
fileinp
,
"%s %s %s %s"
,
isik
[
i
].
nimi
,
isik
[
i
].
tel
,
isik
[
i
].
aadress
[
0
],
isik
[
i
].
aadress
[
1
]);
i
++
;
}
for
(
i
=
0
;
i
<
10
;
i
++
){
if
(
!
(
strcmp
(
isik
[
i
].
aadress
[
1
],
"Tallinn"
))){
fprintf
(
fileoutp
,
"%s %s %s %s
\n
"
,
isik
[
i
].
aadress
[
1
],
isik
[
i
].
nimi
,
isik
[
i
].
tel
,
isik
[
i
].
aadress
[
0
]);
}
}
for
(
i
=
0
;
i
<
10
;
i
++
){
if
(
!
(
strcmp
(
isik
[
i
].
aadress
[
1
],
"Tartu"
))){
fprintf
(
fileoutp
,
"%s %s %s %s
\n
"
,
isik
[
i
].
aadress
[
1
],
isik
[
i
].
nimi
,
isik
[
i
].
tel
,
isik
[
i
].
aadress
[
0
]);
}
}
for
(
i
=
0
;
i
<
10
;
i
++
){
if
((
strcmp
(
isik
[
i
].
aadress
[
1
],
"Tallinn"
))
&&
(
strcmp
(
isik
[
i
].
aadress
[
1
],
"Tartu"
))){
fprintf
(
fileoutp
,
"%s %s %s %s
\n
"
,
isik
[
i
].
aadress
[
1
],
isik
[
i
].
nimi
,
isik
[
i
].
tel
,
isik
[
i
].
aadress
[
0
]);
}
}
fclose
(
fileinp
);
fclose
(
fileoutp
);
return
(
0
);
}
HW/Programming2_HW1.docx
0 → 100644
View file @
dd951c66
File added
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