summaryrefslogtreecommitdiff
path: root/CPP/Basics/Ex2/CodeDemo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Basics/Ex2/CodeDemo.cpp')
-rw-r--r--CPP/Basics/Ex2/CodeDemo.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/CPP/Basics/Ex2/CodeDemo.cpp b/CPP/Basics/Ex2/CodeDemo.cpp
new file mode 100644
index 0000000..0afcd7a
--- /dev/null
+++ b/CPP/Basics/Ex2/CodeDemo.cpp
@@ -0,0 +1,43 @@
+// Learning C++
+// Challenge 04_05
+// Calculate a GPA, by Eduardo CorpeƱo
+
+#include <iostream>
+#include <vector>
+#include "records.h"
+
+using namespace std;
+
+void init_students();
+
+StudentRecords SR;
+int id;
+
+int main()
+{
+ init_students();
+
+ cout << "Enter a student ID: ";
+ cin >> id;
+
+ SR.report_card(id);
+ return 0;
+}
+
+void init_students()
+{
+ SR.add_student(1,"George P. Burdell");
+ SR.add_student(2,"Nancy Rhodes");
+
+ SR.add_course(1,"Algebra",5);
+ SR.add_course(2,"Physics",4);
+ SR.add_course(3,"English",3);
+ SR.add_course(4,"Economics",4);
+
+ SR.add_grade(1,1,'B');
+ SR.add_grade(1,2,'A');
+ SR.add_grade(1,3,'C');
+ SR.add_grade(2,1,'A');
+ SR.add_grade(2,2,'A');
+ SR.add_grade(2,4,'B');
+}