Cześć,
Czy ktoś mógłby naprowadżić mnie gdzie popełniam w tym zadaniu ?
https://pl.spoj.com/problems/AL_20_01/
Niestety, otrzymuje odpowiedz od spoj - błedna odpowedz.
Czy ktoś mógłby podpowiedizeć gdzie jest bład ?
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
using namespace std;
const int ilosc_testow = 100;
struct SMors
{
string morse[26] = { ".-/", "-.../", "-.-./", "-../", "./", "..-./", "--./", "..../", "../", ".---/", "-.-/", ".-../", "--/", "-./", "---/", ".--./", "--.-/", ".-./", ".../", "-/", "..-/", "...-/", ".--/", "-..-/", "-.--/", "--../" };
string Alfabet = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ" };
} Misiak;
int main()
{
vector <string> nowy_tekst;
string tekst;
for (int y = 0; y < ilosc_testow; y++)
{
getline(cin, tekst);
for (int i = 0; i < tekst.length() && i <= 1000; i++)
{
if (isspace(tekst[i]))
{
nowy_tekst.push_back("/");
}
for (int k = 0; k < Misiak.Alfabet.length(); k++)
{
if (toupper(tekst[i]) == Misiak.Alfabet[k])
{
string schowek = Misiak.morse[k];
nowy_tekst.push_back(schowek);
break;
}
}
}
for (int z = 0; z < nowy_tekst.size(); z++)
{
cout << nowy_tekst[z];
}
cout << endl;
nowy_tekst.clear();
}
return 0;
}
pozdsrawiam 