online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <string> #include <iostream> class vdv { private: int age; std::string name, sport; double weight, height; public: vdv() { name = sport = "No name"; age = 0; weight = height = 0; } vdv(std::string _name, std::string _sport, int _age, double _height, double _weight) : name(_name), sport(_sport), age(_age), height(_height), weight(_weight) {}; ~vdv() { name = sport = " "; age = 0; height = weight = 0; } friend std::istream& operator>>(std::istream &is, vdv &obj);//passed second object by reference friend std::ostream& operator<<(std::ostream &os, const vdv &u);//passed second object as a referece to const bool operator>(vdv obj); }; //------------------------------------------ std::istream &operator>>(std::istream &is, vdv &obj) {//added & on second argument is >> obj.name >> obj.sport >> obj.age >> obj.height >> obj.weight; //no need for cout here //check if input succeded if(is) { ;//do something here if you need to } //otherwise leave the objec in its default state else { obj = vdv(); } return is; } std::ostream &operator<< (std::ostream & os, const vdv &obj) {//passed 2nd argument as reference to const os << obj.name << obj.sport << obj.age << obj.height << obj.weight; //no need for cout here return os; } bool vdv::operator>(vdv obj) { if (height > obj.height) return true; else if (height < obj.height) return false; else if (weight >= obj.weight) return true; else return false; } void swap(vdv &o1, vdv &o2) { vdv temp = o1; o1 = o2; o2 = temp; } void bubblesort(vdv *a, int n) { for (int i = 0; i < n - 1; i++) for (int j = 1; j < n; j++) { if (a[i] > a[j]) swap(a[i], a[j]); } } //------------------------------------------ int main() { vdv o1; std::cin >> o1; std::cout << o1; }

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