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 "game.h" using namespace std; int main() { cout << "Test wczytania prowincji\n"; Game::loadProvincesFromFile("wrzutka 1 do statycznego kontenera"); Game::loadProvincesFromFile("kolejna wrzutka do statycznego kontenera"); for (auto &province : Game::provinces) { cout << province << "\n"; } return 0; }
#ifndef GAME_H #define GAME_H #include <vector> #include <string> class Game { public: static void loadProvincesFromFile(const std::string &appendToStaticContainer); static std::vector<std::string> provinces; }; #endif
#include "game.h" #include <iostream> std::vector<std::string> Game::provinces = {"poo", "foo"}; //no i to działa. Logiczne. void Game::loadProvincesFromFile(const std::string &appendToStaticContainer) { //std::vector<std::string> Game::provinces; //cannot be defined in the current scope provinces.push_back("duu"); provinces.push_back("paa"); static std::vector<std::string> container; container.push_back(appendToStaticContainer); std::cout << "Listowanie zawartości statycznego wektora" << "\n"; for (auto &it : container) { std::cout << it << "\n"; } }

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