First Class
Loading...
Searching...
No Matches
student.cpp
Go to the documentation of this file.
1
#include "
student.h
"
2
#include <algorithm>
// erase
3
#include <string>
4
#include <vector>
5
using namespace
std;
6
7
8
void
Student::Add_SKZ
(
const
int
skz)
9
{
10
vector<int>::iterator it;
11
it = find(_skz.begin(),_skz.end(), skz);
12
if
( it == _skz.end()) _skz.push_back(skz);
13
}
14
15
void
Student::Del_SKZ
(
const
int
skz_in)
16
{
17
//vector<int>::iterator it;
18
auto
it = std::find(_skz.begin(),_skz.end(),skz_in);
19
if
( it != _skz.end() ) _skz.erase(it);
20
return
;
21
}
22
23
24
ostream&
operator<<
(ostream& s,
const
Student
& rhs)
25
{
26
s << rhs._name <<
" : "
;
27
//s << rhs.skz << endl;
28
for
(
unsigned
int
k=0; k<rhs._skz.size(); ++k)
29
{
30
s << rhs._skz.at(k) <<
" "
;
31
}
32
return
s;
33
}
34
35
istream&
operator>>
(istream& s,
Student
& rhs)
36
{
37
s >> rhs._name;
38
int
tmp;
39
s >> tmp;
40
rhs.
Add_SKZ
(tmp);
41
return
s;
42
}
Student
Definition
student.h:10
Student::Add_SKZ
void Add_SKZ(const int skz_in)
Definition
student.cpp:8
Student::Del_SKZ
void Del_SKZ(const int skz_in)
Definition
student.cpp:15
operator>>
istream & operator>>(istream &s, Student &rhs)
Definition
student.cpp:35
operator<<
ostream & operator<<(ostream &s, const Student &rhs)
Definition
student.cpp:24
student.h
student.cpp
Generated on Fri May 22 2026 15:05:32 for First Class by
1.9.8