-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathICTCourse.cpp
101 lines (69 loc) · 1.91 KB
/
ICTCourse.cpp
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Name: Parthkumar Patel Date:August 2nd/2016
#include "ICTCourse.h"
#include <iostream>
#include <cstring>
#include <iomanip>
using namespace std;
namespace sict{
ICTCourse::ICTCourse()
{
strncpy(computerSystem__, "matrix",7);
}
ICTCourse::ICTCourse(const char* courseC, const char * courseT, int cred, int studyL, const char * computerS ): Course(courseC , courseT, cred, studyL)
{
strncpy(computerSystem__, computerS,7);
}
const char * ICTCourse::getComputerSystem() const
{
return computerSystem__;
}
void ICTCourse::setComputerSystem(const char * compSys)
{
strcpy(computerSystem__, compSys);
}
ostream& ICTCourse::display(std::ostream & py) const
{
Course::display(py);
py << computerSystem__ << '|' << setw(9) << setfill(' ') << setw(14) << '|' << endl;
return(py);
}
std::ostream& operator<<(std::ostream& out, const ICTCourse& B)
{
B.display(out);
return out;
}
std::fstream& ICTCourse::store(fstream& fileStream, bool addNewLine)const
{
fileStream << TYPE_ICT << ',';
Course::store(fileStream,false);
fileStream << getComputerSystem() ;
if(addNewLine == true)
{
fileStream << '\n';
}
return fileStream;
}
std::fstream& ICTCourse::load(std::fstream& fileStream)
{
Course::load(fileStream);
char compSys[6+1];
fileStream.get(compSys,6+1,'\n');
fileStream.ignore();
setComputerSystem(compSys);
return fileStream;
}
std::istream& ICTCourse::read(istream& is)
{
Course::read(is);
char* compSys = nullptr;
char compSystem[6+1];
if(is.fail() == false)
{
cout << "Computer System: ";
is >> compSystem;
compSys = (char*)compSystem;
setComputerSystem(compSys);
}
return is;
}
};