online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <fstream> #include <vector> #include <string> #include <iomanip> std::vector<std::string> text_in_vector(const std::string &fileName, const std::string &searchStr) { std::vector<std::string> vec; std::ifstream inFile(fileName); std::string str; while (std::getline(inFile >> std::ws, str, ',')) { if (str.find(searchStr) != std::string::npos) vec.push_back(str); } return vec; } int main() { auto vec = text_in_vector("file.txt", "10"); for (auto &elem : vec) { std::cout << elem << std::endl; } }
Karen10, Lili12, Stacy13, Mack10

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text



Program is not being debugged. Click "Debug" button to start program in debug mode.