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 <map> #include <fstream> int main() { std::ifstream inputFile("input.txt"); std::map<std::string, int> countExtOccurence; //this will count how many time each extension occurred std::string name, extension; if(inputFile) { while(std::getline(inputFile, name, '.')) //this will read upto a . occurrs { std::getline(inputFile, extension, '\n'); { countExtOccurence[extension]++; //increase the count corresponding to a given extension } } } else { std::cout<<"input file cannot be opened"<<std::endl; } inputFile.close(); //lets print out how many times each extensino occurred in the file for(const std::pair<std::string, int> &pairElem: countExtOccurence) { std::cout<<pairElem.first<<" occurred: "<<pairElem.second<<" time"<<std::endl; } return 0; }
a.cpp b.txt c.java d.cpp p.cpp q.txt r.java s.cpp a.cpp c.txt c.java d.cpp filename.mp4

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