-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathind_project_week_1.cpp
More file actions
61 lines (60 loc) · 1.77 KB
/
ind_project_week_1.cpp
File metadata and controls
61 lines (60 loc) · 1.77 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
#include <iostream>
using namespace std;
class student{
private:
string studentFirstName;
string studentLastName;
float studentGPA;
public:
void setStudentFirstName(string);
string getStudentFirstName();
void setStudentLastName(string);
string getStudentLastName();
void setStudentGPA(float);
float getStudentGPA();
student();
};
void student:: setStudentFirstName(string name){
name[0]= toupper(name[0]);
studentFirstName = name;
};
void student:: setStudentLastName(string name){
name[0]= toupper(name[0]);
studentLastName = name;
};
void student:: setStudentGPA(float GPA){
studentGPA = GPA;};
string student:: getStudentFirstName(){return studentFirstName;};
string student:: getStudentLastName(){return studentLastName;};
float student:: getStudentGPA(){return studentGPA;};
student:: student(){
studentFirstName = "";
studentLastName = "";
studentGPA = 0;}
void displayStudents(student *stud);
int main(){
string studentFirst = " ";
string studentLast = " ";
float studentGPA = 0;
string voidedVar = " ";
cout << "Please enter the Student's First Name: " << endl;
cin >> studentFirst;
cout << "Please enter the Student's Last Name: " << endl;
cin >> studentLast;
cout << "Please enter the Student's GPA: " << endl;
cin >> studentGPA;
student student1;
student1.setStudentFirstName(studentFirst);
student1.setStudentLastName(studentLast);
student1.setStudentGPA(studentGPA);
//cout << getStudentFirstName() << endl;
//cout << getStudentLastName() << endl;
//cout << getStudentGPA() << endl;
//cin >> voidedVar;
displayStudents(&student1);
}
void displayStudents(student *stud){
cout << "First Name: " << stud->getStudentFirstName()<<endl;
cout << "Last Name: " << stud->getStudentLastName()<<endl;
cout << "GPA: " << stud->getStudentGPA()<< endl;
}