25392023-01-16 18:42:53szabosamuelMorze (60 pont)cpp11Forditási hiba
#include <iostream>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int maxi=s.length();
    string st[maxi/5+1];

    for(int i=0; i<maxi/5; i++)
    {
         st[i]=substr(5*i, 5);
    }
    int n=0;
    for(int i=1; i<maxi/5; i++)
    {
        if(st[i]=="-----") n=10*n;
        else if(st[i]==".----" ) n=10*n+1;
        else if(st[i]=="..---" ) n=10*n+2;
        else if(st[i]=="...--" ) n=10*n+3;
        else if(st[i]=="....-" ) n=10*n+4;
        else if(st[i]=="....." ) n=10*n+5;
        else if(st[i]=="-...." ) n=10*n+6;
        else if(st[i]=="--..." ) n=10*n+7;
        else if(st[i]=="---.." ) n=10*n+8;
        else if(st[i]=="----." ) n=10*n+9;
    }
    cout << n;


    return 0;
}
Forditási hiba
exit status 1
main.cpp: In function 'int main()':
main.cpp:13:16: error: 'substr' was not declared in this scope
   13 |          st[i]=substr(5*i, 5);
      |                ^~~~~~
Exited with error status 1