-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.cpp
48 lines (48 loc) · 804 Bytes
/
Student.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
//Student.cpp
#include"Student.h"
#include<string>
#include<iostream>
#include<fstream>
#include<cstdlib>
Student::Student()
{
setGPA("");
setStatus("");
}
void Student::setGPA(string g)
{
if(g != "0")
gpa = g;
else
gpa = "0";
}
void Student::setStatus(string s)
{
if(s != "")
status = s;
else
status = "";
}
void Student::print(){
cout<<"\nThis student has this information: \n";
School::print();
cout<<"GPA: "<<gpa<<"\n"
<<"Status: "<<status<<endl;
}
void Student::persist()
{
key = 'h';
for(int i = 0; i < gpa.length(); i++)
{
en_gpa += gpa[i] ^ key;
}
for(int i = 0; i < status.length(); i++)
{
en_status += status[i] ^ key;
}
outData.open("JJSchoolRecords.txt", ios::app);
outData<<"s ";
School::persist();
outData<<en_gpa<<" "<<en_status<<endl;
outData.close();
}