Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Prog2
/
eloadas_peldak
/
ea_09
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
473ace78
authored
Apr 18, 2021
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v0
parent
90b5b05d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
0 deletions
+100
-0
orszem/file.txt
+8
-0
orszem/main.cpp
+52
-0
orszem/orszem.cbp
+40
-0
No files found.
orszem/file.txt
0 → 100644
View file @
473ace78
1
2
3
4jhjh
12345678
6
7
8
orszem/main.cpp
0 → 100644
View file @
473ace78
#include <iostream>
#include <fstream>
/// Bugyuta kd, ami megszmolja a sorok szmt.
/// Ha van 9 karakternl hosszabb sora, akkor hibt dob.
int
szamol
(
const
char
*
f
)
{
std
::
ifstream
inp
(
f
);
/// megnyits
int
n
=
0
;
while
(
inp
.
good
())
{
/// file feldolgozsa
char
buf
[
9
+
1
];
inp
.
getline
(
buf
,
9
+
1
);
/// sorvegig, de max 9 kar.
if
(
inp
.
eof
())
break
;
if
(
inp
.
fail
())
{
inp
.
close
();
/// lezrs hiba esetn
throw
"baj_van"
;
}
n
++
;
}
inp
.
close
();
/// lezrs normal esetn
return
(
n
);
}
struct
Inputstream
:
std
::
ifstream
{
Inputstream
(
const
char
*
f
)
:
std
::
ifstream
(
f
)
{}
~
Inputstream
()
{
close
();
}
};
int
szamol2
(
const
char
*
f
)
{
Inputstream
inp
(
f
);
/// megnyits
int
n
=
0
;
while
(
inp
.
good
())
{
/// file feldolgozsa
char
buf
[
9
+
1
];
inp
.
getline
(
buf
,
9
+
1
);
/// sorvegig, de max 9 kar.
if
(
inp
.
eof
())
break
;
if
(
inp
.
fail
())
throw
"baj_van"
;
n
++
;
}
return
(
n
);
}
int
main
()
{
try
{
std
::
cout
<<
szamol2
(
"file.txt"
)
<<
std
::
endl
;
}
catch
(...)
{
std
::
cout
<<
"baj van
\n
"
<<
std
::
endl
;
}
}
orszem/orszem.cbp
0 → 100644
View file @
473ace78
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion
major=
"1"
minor=
"6"
/>
<Project>
<Option
title=
"orszem"
/>
<Option
pch_mode=
"2"
/>
<Option
compiler=
"gcc"
/>
<Build>
<Target
title=
"Debug"
>
<Option
output=
"bin/Debug/orszem"
prefix_auto=
"1"
extension_auto=
"1"
/>
<Option
object_output=
"obj/Debug/"
/>
<Option
type=
"1"
/>
<Option
compiler=
"gcc"
/>
<Compiler>
<Add
option=
"-g"
/>
</Compiler>
</Target>
<Target
title=
"Release"
>
<Option
output=
"bin/Release/orszem"
prefix_auto=
"1"
extension_auto=
"1"
/>
<Option
object_output=
"obj/Release/"
/>
<Option
type=
"1"
/>
<Option
compiler=
"gcc"
/>
<Compiler>
<Add
option=
"-O2"
/>
</Compiler>
<Linker>
<Add
option=
"-s"
/>
</Linker>
</Target>
</Build>
<Compiler>
<Add
option=
"-Wall"
/>
<Add
option=
"-fexceptions"
/>
</Compiler>
<Unit
filename=
"main.cpp"
/>
<Extensions>
<lib_finder
disable_auto=
"1"
/>
</Extensions>
</Project>
</CodeBlocks_project_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