-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenor.cpp
More file actions
70 lines (53 loc) · 1.15 KB
/
Copy pathenor.cpp
File metadata and controls
70 lines (53 loc) · 1.15 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "enor.h"
#include <iostream>
#include <cstdlib>
Enor::Enor(const std::string &filename) {
file.open(filename.c_str());
if(file.fail()) {
st = ABNORM;
throw FILE_ERROR;
exit(1);
}
akt.sorszam = 0;
}
void Enor::Read() {
std::string str;
getline(file,str);
if(!file.fail()) {
st = NORM;
line.clear();
line.str(str);
}
else{
st = ABNORM;
}
}
int Enor::szavak(std::stringstream &sor) {
int db = 0;
std::string tmp;
sor >> tmp;
while(!sor.fail()) {
db = db + 1;
sor >> tmp;
}
return db;
}
void Enor::Next() {
for(;st==NORM && line.str().size()==0; Read());
vege = st == ABNORM;
if(!vege) {
++akt.sorszam;
akt.sor_db = 0;
akt.szo_db = 0;
for(;st==NORM && line.str().size()!=0; Read()) {
++akt.sor_db;
akt.szo_db = akt.szo_db + szavak(line);
//if(Read().fail())
}
}
}
void Enor::seged() {
while(file.eof()) {
std::cout << "meg nem" << std::endl;
}
}