online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <vector> #include <string> #include <fstream> int main() { std::ifstream inputFile("File.txt"); std::string wordName; std::vector<std::string> Names; if(inputFile) { while(getline(inputFile, wordName, '|')) { if((wordName.size()!=0)) { Names.push_back(wordName); } } } else { std::cout<<"File could not be opened"<<std::endl; } inputFile.close(); //lets check/confirm if our vector contains all the names correct names for(const std::string &name: Names) { std::cout<<name<<std::endl; } return 0; }
name1|name2|name3|name4|name5|name6|name7||||||||||name8|||name10

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