online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> using namespace std; #define MAX 10 class Student { private: int ID; string name; string surname; public: Student() { ID = 0; string name = "" ; string surname = ""; } void setID(int ID_set); int getID(); void setName(string name_set); string getName(); void setSurName(string surname_set); string getSurName(); }; class Course { private: Student students[MAX]; int num =0 ; // The current number of students in the course, initially 0. float weightQ; float weightHW; float weightF; public: Course() { students[num] = {}; weightQ = 0.3; weightHW = 0.3; weightF = 0.4; } int getNum(); // Returns how many students are in the course void addNewStudent(Student new_student); void updateWeights(float weightQ_update, float weightHW_update, float weightF_update); void getStudent(int ID_given, Course &course); }; // Method declerations for the class Student void Student :: setID(int ID_set){ ID = ID_set; } int Student :: getID(){ return ID; } void Student :: setName(string name_set){ name = name_set; } string Student :: getName(){ return name; } void Student :: setSurName(string surname_set){ surname = surname_set; } string Student :: getSurName(){ return surname; } // Method declerations for the class Course int Course :: getNum(){ return num; } void Course :: addNewStudent(Student new_student){ students[num] = new_student ; num = num + 1; } void Course :: updateWeights(float weightQ_update, float weightHW_update, float weightF_update){ weightQ = weightQ_update; weightHW = weightHW_update; weightF = weightF_update; } void Course :: getStudent(int ID_given, Course &course){ for(int i = 0; i<MAX; i++){ if(ID_given == students[i].getID()){ cout << "Student Name & Surname : " << students[i].getName() << " " << students[i].getSurName()<<"\n"; } } } void addNewStudent(int ID, string name, string surname, Course &course){ Student student; student.setID(ID); student.setName(name); student.setSurName(surname); course.addNewStudent(student); } void showStudent(int ID, Course &course){ course.getStudent(ID, course); } int main(){ Course ECE101; int x; int ID; string name, surname; string option_1 = "1) Add a student "; string option_2 = "2) Search a student by ID"; cout << "Welcome to the ECE101 Classroom Interface"<<"\n"; cout << "Choose your option\n"; cin >> x; do { if (x == 1) { cout << "Enter the student ID "; cin >> ID; cout << endl; cout << "Enter the student name "; cin >> name; cout << endl; cout << "Enter the student surname " ; cin >> surname; addNewStudent(ID, name, surname, ECE101); } else { cout << "Enter the student ID\n"; cin >> ID; showStudent(ID, ECE101); } cout << "Choose your option\n"; cin >> x; } while(x != 3); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue