FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
StringNAndBlockStream/BlockStreamDriver.cpp at master · AmitSna/StringNAndBlockStream · GitHub
AmitSna
StringNAndBlockStream
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
StringNAndBlockStream
/
BlockStreamDriver.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (36 loc) · 1.09 KB
Breadcrumbs
StringNAndBlockStream
/
BlockStreamDriver.cpp
Copy path
File metadata and controls
45 lines (36 loc) · 1.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
BlockStreamDriver.cpp
Escribe y lee archivo de registros, y muestra los cursos de
primer año con cantidad de alumnos mayor a 25.
2015-11-08 - 2018-06-30
Esp. Ing. José María Sola
Profesor
UTN FRBA
*/
#
include
<
iostream
>
#
include
"
BlockStream.h
"
int
main
(){
struct
Curso
{
char
especialidad;
int
codigo;
int
nivel;
int
alumnos;
double
promedio;
};
constexpr
auto
filename{
"
cursos
"
};
std::ofstream out{filename, std::ios::binary};
WriteBlock
(out, Curso{
'
K
'
,
1051
,
1
,
29
,
7.8
});
WriteBlock
(out, Curso{
'
R
'
,
4152
,
4
,
41
,
6.6
});
WriteBlock
(out, Curso{
'
K
'
,
2051
,
1
,
22
,
6.7
});
WriteBlock
(out, Curso{
'
K
'
,
2011
,
1
,
26
,
7.9
});
out.
close
();
std::ifstream in{filename, std::ios::binary};
for
(Curso curso;
ReadBlock
(in, curso) ;)
if
( curso.
nivel
==
1
and
curso.
alumnos
>
25
)
std::cout
<<
"
Especialidad:
"
<< curso.
especialidad
<<
"
,
"
<<
"
Código:
"
<< curso.
codigo
<<
"
,
"
<<
"
Nivel:
"
<< curso.
nivel
<<
"
,
"
<<
"
Alumnos:
"
<< curso.
alumnos
<<
"
,
"
<<
"
Promedio:
"
<< curso.
promedio
<<
'
\n
'
<<
'
\n
'
;
in.
close
();
}
Back
|
FazBrowse Home
|
New Git URL