online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <fstream> #include <sstream> #include <vector> //this class represents a Student class Student { public: std::string firstName, lastName, courseName ; unsigned long id = 0; float marks = 0; }; int main() { std::ifstream inputFile("input.txt"); std::string line; std::vector<Student> myVec;//create a vector of Student objects if(inputFile) { while(std::getline(inputFile, line)) { Student studentObject; std::istringstream ss(line); //read the id ss >> studentObject.id; //read the firstname ss >> studentObject.firstName; //read the lastname ss >> studentObject.lastName; //read the courseName ss >> studentObject.courseName; //read the marks ss >> studentObject.marks; if(ss)//check if input succeded { myVec.emplace_back(studentObject);//add the studentObject into the vector } } } else { std::cout<<"File cannot be opened"<<std::endl; } //lets print out the elements of the vecotr to confirm that all the students were correctly read for(const Student &elem: myVec) { std::cout << elem.id << ": "<<elem.firstName<<" "<<elem.lastName<<" "<<elem.courseName<<" "<<elem.marks <<std::endl; } return 0; }
9650376 George Jones CS 4.5 9650377 Anooo Singh PH 2.4 9650378 RANDOM NAMES CK 4.7 9650379 First Last LM 6.2 9650380 Richar James CV 4.5 9650381 Sohail Ram CS 1.1

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