online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <fstream> #include <regex> #include <unordered_map> using namespace std; void setmap(std::unordered_map<string,string> &uml,const char * kodowanie1,std::string kodowanie2) { // zakładamy ta samą długość kodu for(size_t i=0; i<strlen(kodowanie1)&&i<kodowanie2.size(); i++) uml[string(1,kodowanie1[i])]=string(1,kodowanie2[i]); } int main() { std::unordered_map <string,string>um; { //string znaki{"ąćęłńóśżźĄĆĘŁŃÓŚŻŹ"}; string znaki{"123456789012345678"}; // ifstream f("znaki.txt"); // if(f) { // cout<<"ok"; // getline(f,znaki,'\0'); // f.close(); // cout<<znaki<<endl; setmap(um,"¹æê³ñ󜿟¥ÆÊ£ÑÓŒ¯",znaki); // } else { // cout<<"error"; // cin.get(); // exit(-1); // } } fstream f("main.cpp"); string plik; if(f) { cout<<"ok"; getline(f,plik,'\0'); f.close(); } else cout <<"nok"; std::regex word_regex("[¹æê³ñ󜿟¥ÆÊ£ÑÓŒ¯]"); auto words_begin = std::sregex_iterator(plik.begin(), plik.end(), word_regex); auto words_end = std::sregex_iterator(); std::cout << "Found " << std::distance(words_begin, words_end) << " words\n"; for(std::sregex_iterator i = words_begin; i != words_end; ++i) { std::smatch match = *i; std::string match_str = match.str(); std::cout << " " <<match_str<<"=="<<um[match_str]<< '\n'; } std::regex_replace(plik, word_regex,um["$&"] ); // cout<<plik<<endl; cout<<"Za¿ó³æ gêœl¹ jaŸñ"<<endl<<endl; // ¹æê³ñ󜿟¥ÆÊ£ÑÓŒ¯ //char str[50] = {0}; cout<<"Podaj jakiœ tekst zwieraj¹cy polskie znaki diakrytyczne: "; //cin.getline(str, sizeof(str)/ sizeof(char)); //cout<<endl<<endl<<"Testowy tekst: "<<str<<endl<<endl; cout<<"Wciœnij enter, aby zamkn¹æ program..."; cin.get(); { ofstream f("main.cpp"); if(f) { cout<<"ok"; f<<plik; f.close(); } else cout <<"nok"; } cout<<plik<<endl; 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