online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include<iostream> #include<string> #include <vector> class director{ std::string name; std::string lastname; public: director(){ } //use constructor initializer list director(std::string a,std::string b): name(a), lastname(b){ } void createDirector() { std::cout<<"Enter name of director:"<<std::endl; std::cin>>name; std::cout<<"Enter last name:"<<std::endl; std::cin>>lastname; } void displayDirector() const { std::cout << "Firstname: "<<name<<" Lastname: "<<lastname<<std::endl; } }; class movie{ std::string name; std::vector<director> directors; //vector of director objects public: //constructor that creates vector directors of size vecSize movie(size_t vecSize): directors(vecSize) { std::cout << "Enter name of movie: "<<std::endl; std::cin >> name; //iterate through the vector and call method createDirector on each element for(director &elem: directors) { elem.createDirector(); } } void displayMovie() { std::cout<<"Movie's name is: "<<name<<std::endl; //iterate through the vector and call displayDirector on each object for(const director& elem: directors) { elem.displayDirector(); } } }; int main(){ movie a(4); //create an object of type movie. Note i have passed 4 as argument you can pass other numbers like 3,2 etc a.displayMovie();//display movie info }

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