NOVOROČNÍ AKCE! Získej 90 % extra kreditů ZDARMA na náš interaktivní e-learning s promo kódem OSLAVY90. Zjisti více:
Avatar
Ladíček Verunka Viktorínovi:3.1.2017 18:53

Zdravim mam problem...nefunguje mi tenhle prekladac a nevim proc.

#include <utility>
#include <string>
#include <iostream>
#include <vector>

using namespace std;

int main () {
vector<pair<string, string> > translations;

translations.push_bac­k(make_pair("tě­lo", "body"));
translations.push_bac­k(make_pair("od­stavec", "p"));

string line;
string content;
content = "";
while (getline(cin, line)) {
content += line+'\n';
}

for (vector<pair<strin­g, string> >::iterator it = translations.be­gin() ; it != translations.end(); ++it) {
size_t index = 0;
while (true) {
index = content.find(it->first, index);
if (index == string::npos) {
break;
}

content.repla­ce(index, it->first.length(), it->second);

index += it->second.length();
}
}

cout << content;
}

 
Odpovědět
3.1.2017 18:53
Děláme co je v našich silách, aby byly zdejší diskuze co nejkvalitnější. Proto do nich také mohou přispívat pouze registrovaní členové. Pro zapojení do diskuze se přihlas. Pokud ještě nemáš účet, zaregistruj se, je to zdarma.

Zobrazeno 1 zpráv z 1.