online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <map> int myFind(char arr[], int len, int seek) { for (int i = 0; i < len; ++i) { if (arr[i] == seek) return i; } return -1; } int main() { char arr[] = {'a','n','o','o','p','s','i','n','g','h','r','a','n','a'}; std::map<char, int> charCount; for(int i = 0; i < sizeof(arr) / sizeof(char); ++i) { charCount[arr[i]]++; } int k = 0; //just go through the inputString instead of map for(int i = 0; i < sizeof(arr) / sizeof(char); ++i) { //std::size_t index = inputString.find(arr[i]); int index = myFind(arr,sizeof(arr) / sizeof(char),arr[i]); if(index != -1 && (index == k)){ std::cout << arr[i] <<"-" << charCount.at(arr[i])<<std::endl; } ++k; } return 0; }

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