25402023-01-16 18:44:07szabosamuelMorze (60 pont)cpp11Compilation error
#include <iostream>
#include <string.h>
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;
}
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:14:16: error: 'substr' was not declared in this scope; did you mean 'strstr'?
   14 |          st[i]=substr(5*i, 5);
      |                ^~~~~~
      |                strstr
Exited with error status 1